aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-07-20 12:41:26 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-07-20 12:41:33 -0400
commit5512427b19e79ac95535e7c942bd479db807f7be (patch)
treea7bc823d5ae582f4cd8b05f4521621fc476f5e7d
parent41ada83774929c3bbb069a90f2aa3a8ac508e876 (diff)
downloadpostgresql-5512427b19e79ac95535e7c942bd479db807f7be.tar.gz
postgresql-5512427b19e79ac95535e7c942bd479db807f7be.zip
Doc: clarify description of degenerate NATURAL joins.
Claiming that NATURAL JOIN is equivalent to CROSS JOIN when there are no common column names is only strictly correct if it's an inner join; you can't say e.g. CROSS LEFT JOIN. Better to explain it as meaning JOIN ON TRUE, instead. Per a suggestion from David Johnston. Discussion: https://postgr.es/m/CAKFQuwb+mYszQhDS9f_dqRrk1=Pe-S6D=XMkAXcDf4ykKPmgKQ@mail.gmail.com
-rw-r--r--doc/src/sgml/queries.sgml4
-rw-r--r--doc/src/sgml/ref/select.sgml7
2 files changed, 7 insertions, 4 deletions
diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml
index 5cc6dbce11b..b851d134b72 100644
--- a/doc/src/sgml/queries.sgml
+++ b/doc/src/sgml/queries.sgml
@@ -393,8 +393,8 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
consisting of all column names that appear in both
input tables. As with <literal>USING</>, these columns appear
only once in the output table. If there are no common
- column names, <literal>NATURAL</literal> behaves like
- <literal>CROSS JOIN</literal>.
+ column names, <literal>NATURAL JOIN</literal> behaves like
+ <literal>JOIN ... ON TRUE</literal>, producing a cross-product join.
</para>
<note>
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index 211e4c320ce..57f11e66fb6 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -603,9 +603,12 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
<varlistentry>
<term><literal>NATURAL</literal></term>
<listitem>
- <para><literal>NATURAL</literal> is shorthand for a
+ <para>
+ <literal>NATURAL</literal> is shorthand for a
<literal>USING</> list that mentions all columns in the two
- tables that have the same names.
+ tables that have matching names. If there are no common
+ column names, <literal>NATURAL</literal> is equivalent
+ to <literal>ON TRUE</>.
</para>
</listitem>
</varlistentry>