We have on the TODO list:
* SELECT pg_class FROM pg_class generates strange error
It passes the tablename as targetlist all the way to the executor, where
it throws an error about Node 704 unkown.
This patch fixes the problem by generating an error in the parser:
test=> select pg_class from pg_class;
ERROR: You can't use a relation alone in a target list.
It passes regression tests.
FYI, I am working down the TODO list, doing items I can handle.
I will apply later if no one objects.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Index: src/backend/parser/parse_target.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_target.c,v
retrieving revision 1.66
diff -c -r1.66 parse_target.c
*** src/backend/parser/parse_target.c 2001/03/22 03:59:41 1.66
--- src/backend/parser/parse_target.c 2001/05/19 03:07:41
***************
*** 55,60 ****
--- 55,63 ----
if (expr == NULL)
expr = transformExpr(pstate, node, EXPR_COLUMN_FIRST);
+ if (IsA(expr, Ident) && ((Ident *) expr)->isRel)
+ elog(ERROR,"You can't use a relation alone in a target list.");
+
type_id = exprType(expr);
type_mod = exprTypmod(expr);