Correct error in grammar for subselect-in-FROM: SQL spec does not allow

omission of alias_clause for a subselect.
This commit is contained in:
Tom Lane 2000-09-25 18:38:39 +00:00
parent 8bdc2bf030
commit e353e73768
1 changed files with 5 additions and 8 deletions

View 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 (<derived_table>)
* 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);