Print error on SELECT tab FROM tab:
authorBruce Momjian
Mon, 21 May 2001 18:42:08 +0000 (18:42 +0000)
committerBruce Momjian
Mon, 21 May 2001 18:42:08 +0000 (18:42 +0000)
   You can't use relation names alone in the target list, try relation.*

doc/TODO
src/backend/parser/parse_expr.c
src/backend/parser/parse_target.c
src/include/nodes/parsenodes.h

index b4f32d3c6a3c565e84e0dc51f719aee0ae9ee836..cd52a8339346f3d4af8db6479363acd6c972a9b6 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,6 +1,6 @@
 TODO list for PostgreSQL
 ========================
-Last updated:      Mon May 21 14:36:45 EDT 2001
+Last updated:      Mon May 21 14:40:08 EDT 2001
 
 Current maintainer:    Bruce Momjian ([email protected])
 
index 08a2f5f20351350f0aa964b7a9328e95b81ea07d..4cbbc1c980c805001fe2b682d44dd016633fa10d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.95 2001/05/19 00:33:20 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.96 2001/05/21 18:42:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -585,7 +585,10 @@ transformIdent(ParseState *pstate, Ident *ident, int precedence)
        Node       *var = colnameToVar(pstate, ident->name);
 
        if (var != NULL)
+       {
+           ident->isRel = FALSE;
            result = transformIndirection(pstate, var, ident->indirection);
+       }
    }
 
    if (result == NULL)
index 8f8ea4e168b5062861cac69fe9b13c28d30c8302..be48c899ddb8d5de973aeac60aa655f22f2218a7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.66 2001/03/22 03:59:41 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.67 2001/05/21 18:42:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,6 +55,9 @@ transformTargetEntry(ParseState *pstate,
    if (expr == NULL)
        expr = transformExpr(pstate, node, EXPR_COLUMN_FIRST);
 
+   if (IsA(expr, Ident) && ((Ident *)expr)->isRel)
+       elog(ERROR,"You can't use relation names alone in the target list, try relation.*.");   
+
    type_id = exprType(expr);
    type_mod = exprTypmod(expr);
 
index cfea5222965869fc3b15e0a58940b902b17abc8d..ff4cc278312204af65879b3a96d7320785df2dc6 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.128 2001/05/20 20:28:20 tgl Exp $
+ * $Id: parsenodes.h,v 1.129 2001/05/21 18:42:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1081,8 +1081,7 @@ typedef struct Ident
    NodeTag     type;
    char       *name;           /* its name */
    List       *indirection;    /* array references */
-   bool        isRel;          /* is a relation - filled in by
-                                * transformExpr() */
+   bool        isRel;          /* is this a relation or a column? */
 } Ident;
 
 /*