From: Tom Lane Date: Thu, 27 Sep 2007 17:42:09 +0000 (+0000) Subject: Fix Assert failure in ExpandColumnRefStar --- what I thought was a can't X-Git-Tag: REL8_2_6~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f850ee9aae6fb09b92fa58235378a7d6bb83c69;p=thirdparty%2Fpostgresql.git Fix Assert failure in ExpandColumnRefStar --- what I thought was a can't happen condition can happen given incorrect input. The real problem is that gram.y should try harder to distinguish * from "*" --- the latter is a legal column name per spec, and someday we ought to treat it that way. However fixing that is too invasive for a back-patch, and it's too late for the 8.3 cycle too. So just reduce the Assert to a plain elog for now. Per report from NikhilS. --- diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index bb4b065eebb..01cd5b6305d 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.149 2006/10/04 00:29:56 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.149.2.1 2007/09/27 17:42:09 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -826,9 +826,12 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, * (e.g., SELECT * FROM emp, dept) * * Since the grammar only accepts bare '*' at top level of SELECT, we - * need not handle the targetlist==false case here. + * need not handle the targetlist==false case here. However, we must + * test for it because the grammar currently fails to distinguish + * a quoted name "*" from a real asterisk. */ - Assert(targetlist); + if (!targetlist) + elog(ERROR, "invalid use of *"); return ExpandAllTables(pstate); }