Skip to content

Commit e353e73

Browse files
committed
Correct error in grammar for subselect-in-FROM: SQL spec does not allow
omission of alias_clause for a subselect.
1 parent 8bdc2bf commit e353e73

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/backend/parser/gram.y

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.191 2000/09/19 18:17:55 petere Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.192 2000/09/25 18:38:39 tgl Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -3751,6 +3751,10 @@ from_list: from_list ',' table_ref { $$ = lappend($1, $3); }
37513751
* between table_ref := '(' joined_table ')' alias_clause
37523752
* and joined_table := '(' joined_table ')'. So, we must have the
37533753
* redundant-looking productions here instead.
3754+
*
3755+
* Note that the SQL spec does not permit a subselect (<derived_table>)
3756+
* without an alias clause, so we don't either. This avoids the problem
3757+
* of needing to invent a refname for an unlabeled subselect.
37543758
*/
37553759
table_ref: relation_expr
37563760
{
@@ -3761,13 +3765,6 @@ table_ref: relation_expr
37613765
$1->name = $2;
37623766
$$ = (Node *) $1;
37633767
}
3764-
| '(' select_clause ')'
3765-
{
3766-
RangeSubselect *n = makeNode(RangeSubselect);
3767-
n->subquery = $2;
3768-
n->name = NULL;
3769-
$$ = (Node *) n;
3770-
}
37713768
| '(' select_clause ')' alias_clause
37723769
{
37733770
RangeSubselect *n = makeNode(RangeSubselect);

0 commit comments

Comments
 (0)