Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc5894b

Browse files
committed
Adjust parser so that POSTQUEL-style implicit RTEs are stored with
inFromCl true, meaning that they will list out as explicit RTEs if theyare in a view or rule. Update comments about inFromCl to reflect the wayit's now actually used. Per recent discussion.
1 parent7d9ff58 commitfc5894b

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

‎doc/src/sgml/release.sgml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.393 2005/10/25 17:54:30 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.394 2005/10/26 19:21:53 tgl Exp $
33

44
Typical markup:
55

@@ -268,9 +268,19 @@ pg_[A-Za-z0-9_] <application>
268268
</para>
269269
<para>
270270
By default, we now generate an error if a table is used in a query
271-
without a <command>FROM</> reference. The old behavior is still
271+
without a <literal>FROM</> reference. The old behavior is still
272272
available, but the parameter must be set to 'true' to obtain it.
273273
</para>
274+
275+
<para>
276+
It may be necessary to set <varname>add_missing_from</> to true
277+
in order to load an existing dump file, if the dump contains any
278+
views or rules created using the implicit-<literal>FROM</> syntax.
279+
This should be a one-time annoyance, because
280+
<productname>PostgreSQL</productname> 8.1 will convert
281+
such views and rules to standard explicit-<literal>FROM</> syntax.
282+
Subsequent dumps will therefore not have the problem.
283+
</para>
274284
</listitem>
275285

276286
<listitem>

‎src/backend/parser/parse_relation.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.115 2005/10/15 02:49:22 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.116 2005/10/26 19:21:54 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1005,7 +1005,13 @@ addImplicitRTE(ParseState *pstate, RangeVar *relation)
10051005
{
10061006
RangeTblEntry*rte;
10071007

1008-
rte=addRangeTableEntry(pstate,relation,NULL, false, false);
1008+
/*
1009+
* Note that we set inFromCl true, so that the RTE will be listed
1010+
* explicitly if the parsetree is ever decompiled by ruleutils.c.
1011+
* This provides a migration path for views/rules that were originally
1012+
* written with implicit-RTE syntax.
1013+
*/
1014+
rte=addRangeTableEntry(pstate,relation,NULL, false, true);
10091015
/* Add to joinlist and relnamespace, but not varnamespace */
10101016
addRTEtoQuery(pstate,rte, true, true, false);
10111017
warnAutoRange(pstate,relation);

‎src/include/nodes/parsenodes.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.291 2005/10/15 02:49:45 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.292 2005/10/26 19:21:55 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -476,14 +476,12 @@ typedef struct LockingClause
476476
* RTEs other than RTE_RELATION entries.
477477
*
478478
* inFromCl marks those range variables that are listed in the FROM clause.
479-
* In SQL, the query can only refer to range variables listed in the
480-
* FROM clause, but POSTQUEL allows you to refer to tables not listed,
481-
* in which case a range table entry will be generated.We still support
482-
* this POSTQUEL feature, although there is some doubt whether it's
483-
* convenient or merely confusing. The flag is not actually needed
484-
* anymore during parsing, since the parser uses a separate "namespace"
485-
* data structure to control visibility, but it is needed by ruleutils.c
486-
* to determine whether RTEs should be included in decompiled queries.
479+
* It's false for RTEs that are added to a query behind the scenes, such
480+
* as the NEW and OLD variables for a rule, or the subqueries of a UNION.
481+
* This flag is not used anymore during parsing, since the parser now uses
482+
* a separate "namespace" data structure to control visibility, but it is
483+
* needed by ruleutils.c to determine whether RTEs should be shown in
484+
* decompiled queries.
487485
*
488486
* requiredPerms and checkAsUser specify run-time access permissions
489487
* checks to be performed at query startup.The user must have *all*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp