From 80af818dd618b18d8e4b3f629844190473f2bae2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 20 Jul 2017 12:41:26 -0400 Subject: [PATCH] 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 --- doc/src/sgml/queries.sgml | 4 ++-- doc/src/sgml/ref/select.sgml | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml index 9d706d4e798..a3e138cbaae 100644 --- a/doc/src/sgml/queries.sgml +++ b/doc/src/sgml/queries.sgml @@ -393,8 +393,8 @@ FROM table_reference , table_r consisting of all column names that appear in both input tables. As with USING, these columns appear only once in the output table. If there are no common - column names, NATURAL behaves like - CROSS JOIN. + column names, NATURAL JOIN behaves like + JOIN ... ON TRUE, producing a cross-product join. diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 8d4018b7ff1..7b8b63f6b98 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -491,9 +491,12 @@ TABLE [ ONLY ] table_name [ * ] NATURAL - NATURAL is shorthand for a + + NATURAL is shorthand for a 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, NATURAL is equivalent + to ON TRUE. -- 2.39.5