diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-10-26 19:21:55 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-10-26 19:21:55 +0000 |
commit | fc5894bf779e6d0b96dcb8d5b8fb22994de48f92 (patch) | |
tree | f82f3cd4992b00c2526138dc4f2a78d5f7dac574 /src | |
parent | 7d9ff58b2285e46bead8e218666a2c25711d6347 (diff) | |
download | postgresql-fc5894bf779e6d0b96dcb8d5b8fb22994de48f92.tar.gz postgresql-fc5894bf779e6d0b96dcb8d5b8fb22994de48f92.zip |
Adjust parser so that POSTQUEL-style implicit RTEs are stored with
inFromCl true, meaning that they will list out as explicit RTEs if they
are in a view or rule. Update comments about inFromCl to reflect the way
it's now actually used. Per recent discussion.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/parser/parse_relation.c | 10 | ||||
-rw-r--r-- | src/include/nodes/parsenodes.h | 16 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index 61a0549ee0b..efa9b49931c 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.115 2005/10/15 02:49:22 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.116 2005/10/26 19:21:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1005,7 +1005,13 @@ addImplicitRTE(ParseState *pstate, RangeVar *relation) { RangeTblEntry *rte; - rte = addRangeTableEntry(pstate, relation, NULL, false, false); + /* + * Note that we set inFromCl true, so that the RTE will be listed + * explicitly if the parsetree is ever decompiled by ruleutils.c. + * This provides a migration path for views/rules that were originally + * written with implicit-RTE syntax. + */ + rte = addRangeTableEntry(pstate, relation, NULL, false, true); /* Add to joinlist and relnamespace, but not varnamespace */ addRTEtoQuery(pstate, rte, true, true, false); warnAutoRange(pstate, relation); diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 766076b7d6b..5adb79ef6bc 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.291 2005/10/15 02:49:45 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.292 2005/10/26 19:21:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -476,14 +476,12 @@ typedef struct LockingClause * RTEs other than RTE_RELATION entries. * * inFromCl marks those range variables that are listed in the FROM clause. - * In SQL, the query can only refer to range variables listed in the - * FROM clause, but POSTQUEL allows you to refer to tables not listed, - * in which case a range table entry will be generated. We still support - * this POSTQUEL feature, although there is some doubt whether it's - * convenient or merely confusing. The flag is not actually needed - * anymore during parsing, since the parser uses a separate "namespace" - * data structure to control visibility, but it is needed by ruleutils.c - * to determine whether RTEs should be included in decompiled queries. + * It's false for RTEs that are added to a query behind the scenes, such + * as the NEW and OLD variables for a rule, or the subqueries of a UNION. + * This flag is not used anymore during parsing, since the parser now uses + * a separate "namespace" data structure to control visibility, but it is + * needed by ruleutils.c to determine whether RTEs should be shown in + * decompiled queries. * * requiredPerms and checkAsUser specify run-time access permissions * checks to be performed at query startup. The user must have *all* |