code: func (nr *nameResolver) handleColumnName(cn *ast.ColumnNameExpr) {
  	ctx := nr.currentContext()
  	if ctx.inOnCondition {
  		// In on condition, only tables within current join is available.
  		nr.resolveColumnNameInOnCondition(cn)
  		return
  	}
  
  	// Try to resolve the column name form top to bottom in the context stack.
  	for i := len(nr.contextStack) - 1; i >= 0; i-- {
  		if nr.resolveColumnNameInContext(nr.contextStack[i], cn) {
  			// Column is already resolved or encountered an error.
  			if i < len(nr.contextStack)-1 {
  				// If in subselect, the query use outer query.
  				nr.currentContext().useOuterContext = true
  			}
  			return
  		}
  	}
  	nr.Err = errors.Errorf("unknown column %s", cn.Name.Name.L)
  }
docs: // handleColumnName looks up and sets ResultField for
  // the column name.