Fix poor choice of error message in corner cases.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Apr 2004 21:30:44 +0000 (21:30 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Apr 2004 21:30:44 +0000 (21:30 +0000)
src/backend/parser/parse_func.c

index deab6c2ad34e0950f87b21ea2699c84e9b020ac1..64da3bb8425d752c9ac8164a39a4f4c86b9c94b1 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.167 2004/04/02 19:06:58 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.168 2004/04/02 21:30:44 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1221,7 +1221,8 @@ unknown_attribute(ParseState *pstate, Node *relref, char *attname)
 {
    RangeTblEntry *rte;
 
-   if (IsA(relref, Var))
+   if (IsA(relref, Var) &&
+       ((Var *) relref)->varattno == InvalidAttrNumber)
    {
        /* Reference the RTE by alias not by actual table name */
        rte = GetRTEByRangeTablePosn(pstate,