aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2005-04-08 00:59:59 +0000
committerNeil Conway <neilc@samurai.com>2005-04-08 00:59:59 +0000
commiteb4b7a0b778ab2e67e43b41822ddae32803a30e3 (patch)
tree0373c18823016c90ef3412416d6eb2c25bc41afd /doc/src
parentf53cd94a786cf3240040098adeb9d9a9fe30e5b4 (diff)
downloadpostgresql-eb4b7a0b778ab2e67e43b41822ddae32803a30e3.tar.gz
postgresql-eb4b7a0b778ab2e67e43b41822ddae32803a30e3.zip
Change the default setting of "add_missing_from" to false. This has been
the long-term plan for this behavior for quite some time, but it is only possible now that DELETE has a USING clause so that the user can join other tables in a DELETE statement without relying on this behavior.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/delete.sgml8
-rw-r--r--doc/src/sgml/ref/select.sgml47
-rw-r--r--doc/src/sgml/ref/show.sgml4
-rw-r--r--doc/src/sgml/runtime.sgml30
4 files changed, 36 insertions, 53 deletions
diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml
index 954391a228b..598936cd5ac 100644
--- a/doc/src/sgml/ref/delete.sgml
+++ b/doc/src/sgml/ref/delete.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/delete.sgml,v 1.23 2005/04/07 01:51:37 neilc Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/delete.sgml,v 1.24 2005/04/08 00:59:58 neilc Exp $
PostgreSQL documentation
-->
@@ -148,12 +148,6 @@ DELETE FROM films
In some cases the join style is easier to write or faster to
execute than the sub-select style.
</para>
-
- <para>
- If <varname>add_missing_from</varname> is enabled, any relations
- mentioned in the <literal>WHERE</literal> condition will be
- implicitly added to the <literal>USING</literal> clause.
- </para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index 93218e16c2e..9044adfa8c8 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.82 2005/03/10 23:21:20 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.83 2005/04/08 00:59:58 neilc Exp $
PostgreSQL documentation
-->
@@ -1011,42 +1011,21 @@ SELECT 2+2;
</para>
<para>
- A less obvious use is to abbreviate a normal
- <command>SELECT</command> from tables:
+ Note that if a <literal>FROM</literal> clause is not specified,
+ the query cannot reference any database tables. For example, the
+ following query is invalid:
<programlisting>
SELECT distributors.* WHERE distributors.name = 'Westward';
-
- did | name
------+----------
- 108 | Westward
-</programlisting>
- This works because an implicit <literal>FROM</literal> item is
- added for each table that is referenced in other parts of the
- <command>SELECT</command> statement but not mentioned in
- <literal>FROM</literal>.
- </para>
-
- <para>
- While this is a convenient shorthand, it's easy to misuse. For
- example, the command
-<programlisting>
-SELECT distributors.* FROM distributors d;
-</programlisting>
- is probably a mistake; most likely the user meant
-<programlisting>
-SELECT d.* FROM distributors d;
-</programlisting>
- rather than the unconstrained join
-<programlisting>
-SELECT distributors.* FROM distributors d, distributors distributors;
</programlisting>
- that he will actually get. To help detect this sort of mistake,
- <productname>PostgreSQL</productname> will warn if the
- implicit-<literal>FROM</literal> feature is used in a
- <command>SELECT</command> statement that also contains an explicit
- <literal>FROM</literal> clause. Also, it is possible to disable
- the implicit-<literal>FROM</literal> feature by setting the
- <xref linkend="guc-add-missing-from"> parameter to false.
+ <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.
</para>
</refsect2>
diff --git a/doc/src/sgml/ref/show.sgml b/doc/src/sgml/ref/show.sgml
index 8fb07bc9e46..5fdfa2b4b06 100644
--- a/doc/src/sgml/ref/show.sgml
+++ b/doc/src/sgml/ref/show.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/show.sgml,v 1.37 2005/01/04 03:58:16 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/show.sgml,v 1.38 2005/04/08 00:59:58 neilc Exp $
PostgreSQL documentation
-->
@@ -166,7 +166,7 @@ SHOW geqo;
SHOW ALL;
name | setting
--------------------------------+----------------------------------------------
- add_missing_from | on
+ add_missing_from | off
archive_command | unset
australian_timezones | off
.
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index f019dbb4ae6..e5567abf279 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.312 2005/03/29 03:01:29 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.313 2005/04/08 00:59:57 neilc Exp $
-->
<chapter Id="runtime">
@@ -3553,15 +3553,25 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</indexterm>
<listitem>
<para>
- When <literal>true</>, tables that are referenced by a query will be
- automatically added to the <literal>FROM</> clause if not already
- present. The default is <literal>true</> for compatibility with
- previous releases of <productname>PostgreSQL</>. However, this
- behavior is not SQL-standard, and many people dislike it because it
- can mask mistakes (such as referencing a table where you should have
- referenced its alias). Set to <literal>false</> for the SQL-standard
- behavior of rejecting references to tables that are not listed in
- <literal>FROM</>.
+ When <literal>true</>, 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>false</>. 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>