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.
* (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);
}