Correct error in grammar for subselect-in-FROM: SQL spec does not allow
authorTom Lane
Mon, 25 Sep 2000 18:38:39 +0000 (18:38 +0000)
committerTom Lane
Mon, 25 Sep 2000 18:38:39 +0000 (18:38 +0000)
omission of alias_clause for a subselect.

src/backend/parser/gram.y

index a422bf705ac7117c11d1b8295ff4f15386f503f3..93aa912f45b11f6e909c6319946e3ec1f286001f 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.191 2000/09/19 18:17:55 petere Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.192 2000/09/25 18:38:39 tgl Exp $
  *
  * HISTORY
  *   AUTHOR            DATE            MAJOR EVENT
@@ -3751,6 +3751,10 @@ from_list:  from_list ',' table_ref              { $$ = lappend($1, $3); }
  * between table_ref := '(' joined_table ')' alias_clause
  * and joined_table := '(' joined_table ')'.  So, we must have the
  * redundant-looking productions here instead.
+ *
+ * Note that the SQL spec does not permit a subselect ()
+ * without an alias clause, so we don't either.  This avoids the problem
+ * of needing to invent a refname for an unlabeled subselect.
  */
 table_ref:  relation_expr
                {
@@ -3761,13 +3765,6 @@ table_ref:  relation_expr
                    $1->name = $2;
                    $$ = (Node *) $1;
                }
-       | '(' select_clause ')'
-               {
-                   RangeSubselect *n = makeNode(RangeSubselect);
-                   n->subquery = $2;
-                   n->name = NULL;
-                   $$ = (Node *) n;
-               }
        | '(' select_clause ')' alias_clause
                {
                    RangeSubselect *n = makeNode(RangeSubselect);