1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Remove add_missing_from GUC and associated parser support for "implicit RTEs".

Per recent discussion, add_missing_from has been deprecated for long enough to
consider removing, and it's getting in the way of planned parser refactoring.
The system now always behaves as though add_missing_from were OFF.
This commit is contained in:
Tom Lane
2009-10-21 20:22:38 +00:00
parent e1c96527c7
commit 289e2905c8
17 changed files with 57 additions and 204 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.230 2009/10/03 23:10:47 momjian Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.231 2009/10/21 20:22:38 tgl Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
@ -4659,37 +4659,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
<variablelist>
<varlistentry id="guc-add-missing-from" xreflabel="add_missing_from">
<term><varname>add_missing_from</varname> (<type>boolean</type>)</term>
<indexterm><primary>FROM</><secondary>missing</></>
<indexterm>
<primary><varname>add_missing_from</> configuration parameter</primary>
</indexterm>
<listitem>
<para>
When on, tables that are referenced by a query will be
automatically added to the <literal>FROM</> clause if not
already present. This behavior does not comply with the SQL
standard and many people dislike it because it can mask mistakes
(such as referencing a table where you should have referenced
its alias). The default is <literal>off</>. This variable can be
enabled for compatibility with releases of
<productname>PostgreSQL</> prior to 8.1, where this behavior was
allowed by default.
</para>
<para>
Note that even when this variable is enabled, a warning
message will be emitted for each implicit <literal>FROM</>
entry referenced by a query. Users are encouraged to update
their applications to not rely on this behavior, by adding all
tables referenced by a query to the query's <literal>FROM</>
clause (or its <literal>USING</> clause in the case of
<command>DELETE</>).
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-array-nulls" xreflabel="array_nulls">
<term><varname>array_nulls</varname> (<type>boolean</type>)</term>
<indexterm>

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/queries.sgml,v 1.55 2009/06/17 21:58:49 tgl Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/queries.sgml,v 1.56 2009/10/21 20:22:38 tgl Exp $ -->
<chapter id="queries">
<title>Queries</title>
@ -521,23 +521,13 @@ SELECT * FROM some_very_long_table_name s JOIN another_fairly_long_name a ON s.i
</para>
<para>
The alias becomes the new name of the table reference for the
current query &mdash; it is no longer possible to refer to the table
by the original name. Thus:
The alias becomes the new name of the table reference so far as the
current query is concerned &mdash; it is not allowed to refer to the
table by the original name elsewhere in the query. Thus, this is not
valid:
<programlisting>
SELECT * FROM my_table AS m WHERE my_table.a &gt; 5;
SELECT * FROM my_table AS m WHERE my_table.a &gt; 5; -- wrong
</programlisting>
is not valid according to the SQL standard. In
<productname>PostgreSQL</productname> this will draw an error, assuming the
<xref linkend="guc-add-missing-from"> configuration variable is
<literal>off</> (as it is by default). If it is <literal>on</>,
an implicit table reference will be added to the
<literal>FROM</literal> clause, so the query is processed as if
it were written as:
<programlisting>
SELECT * FROM my_table AS m, my_table AS my_table WHERE my_table.a &gt; 5;
</programlisting>
That will result in a cross join, which is usually not what you want.
</para>
<para>

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.125 2009/09/18 05:00:42 petere Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.126 2009/10/21 20:22:38 tgl Exp $
PostgreSQL documentation
-->
@ -1451,12 +1451,7 @@ SELECT distributors.* WHERE distributors.name = 'Westward';
<productname>PostgreSQL</productname> releases prior to
8.1 would accept queries of this form, and add an implicit entry
to the query's <literal>FROM</literal> clause for each table
referenced by the query. This is no longer the default behavior,
because it does not comply with the SQL standard, and is
considered by many to be error-prone. For compatibility with
applications that rely on this behavior the <xref
linkend="guc-add-missing-from"> configuration variable can be
enabled.
referenced by the query. This is no longer allowed.
</para>
</refsect2>

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/show.sgml,v 1.47 2008/11/14 10:22:47 petere Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/show.sgml,v 1.48 2009/10/21 20:22:38 tgl Exp $
PostgreSQL documentation
-->
@ -168,16 +168,15 @@ SHOW geqo;
Show all settings:
<programlisting>
SHOW ALL;
name | setting | description
--------------------------------+--------------------------------+----------------------------------------------------------------------------------------------
add_missing_from | off | Automatically adds missing table references to FROM clauses.
allow_system_table_mods | off | Allows modifications of the structure of system tables.
name | setting | description
---------------------------------+-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------
allow_system_table_mods | off | Allows modifications of the structure of system tables.
.
.
.
work_mem | 1024 | Sets the maximum memory to be used for query workspaces.
zero_damaged_pages | off | Continues processing past damaged page headers.
(146 rows)
xmloption | content | Sets whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments.
zero_damaged_pages | off | Continues processing past damaged page headers.
(196 rows)
</programlisting>
</para>
</refsect1>