*** src/backend/parser/gram.y	29 Aug 2004 04:12:35 -0000	2.475
--- src/backend/parser/gram.y	20 Sep 2004 21:34:13 -0000
*************** table_ref:	relation_expr
*** 5158,5177 ****
  				{
  					/*
  					 * 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 unique refname for it.
! 					 * That could be surmounted if there's sufficient
! 					 * popular demand, but for now let's just implement
! 					 * the spec and see if anyone complains.
! 					 * However, it does seem like a good idea to emit
! 					 * an error message that's better than "syntax error".
  					 */
! 					ereport(ERROR,
! 							(errcode(ERRCODE_SYNTAX_ERROR),
! 							 errmsg("subquery in FROM must have an alias"),
! 							 errhint("For example, FROM (SELECT ...) [AS] foo.")));
! 					$$ = NULL;
  				}
  			| select_with_parens alias_clause
  				{
--- 5158,5172 ----
  				{
  					/*
  					 * The SQL spec does not permit a subselect
! 					 * (<derived_table>) without an alias clause, We surmount
! 					 * this because of popular demand by gining up a fake name
! 					 * in transformRangeSubselect
  					 */
! 
! 					RangeSubselect *n = makeNode(RangeSubselect);
! 					n->subquery = $1;
! 					n->alias = NULL;
! 					$$ = (Node *) n;
  				}
  			| select_with_parens alias_clause
  				{
Index: src/backend/parser/parse_clause.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/backend/parser/parse_clause.c,v
retrieving revision 1.136
diff -u -p -c -r1.136 parse_clause.c
