Re: AW: [HACKERS] Fix for tablename in targetlist - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: AW: [HACKERS] Fix for tablename in targetlist |
Date | |
Msg-id | 200105211836.f4LIa1W10171@candle.pha.pa.us Whole thread Raw |
List | pgsql-patches |
Patch applied and attached. TODO updated. > Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes: > >> select pg_class from pg_class; > > > Probably a valid interpretation would be if type pg_class or opaque had an > > output function. > > Hmm, good point. We shouldn't foreclose the possibility of handling > things that way. Okay, I'm convinced: allowing .* to be omitted isn't > a good idea. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl > -- 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_expr.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_expr.c,v retrieving revision 1.95 diff -c -r1.95 parse_expr.c *** src/backend/parser/parse_expr.c 2001/05/19 00:33:20 1.95 --- src/backend/parser/parse_expr.c 2001/05/21 17:59:13 *************** *** 585,591 **** --- 585,594 ---- Node *var = colnameToVar(pstate, ident->name); if (var != NULL) + { + ident->isRel = FALSE; result = transformIndirection(pstate, var, ident->indirection); + } } if (result == NULL) 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/21 17:59:14 *************** *** 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 relation names alone in the target list, try relation.*."); + type_id = exprType(expr); type_mod = exprTypmod(expr); Index: src/include/nodes/parsenodes.h =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/nodes/parsenodes.h,v retrieving revision 1.127 diff -c -r1.127 parsenodes.h *** src/include/nodes/parsenodes.h 2001/05/07 00:43:25 1.127 --- src/include/nodes/parsenodes.h 2001/05/21 17:59:19 *************** *** 1080,1087 **** NodeTag type; char *name; /* its name */ List *indirection; /* array references */ ! bool isRel; /* is a relation - filled in by ! * transformExpr() */ } Ident; /* --- 1080,1086 ---- NodeTag type; char *name; /* its name */ List *indirection; /* array references */ ! bool isRel; /* is this a relation or a column? */ } Ident; /*
pgsql-patches by date: