]> granicus.if.org Git - postgresql/commit
Fix dumping of outer joins with empty qual lists.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 20 Jul 2017 15:29:36 +0000 (11:29 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 20 Jul 2017 15:29:36 +0000 (11:29 -0400)
commite947838ae432579d86fa35f0b4d6a384c20d4824
tree0c1b21625f53524377b930358e6ad4703adbf07d
parentcd969b23bc03d0251310f6f6a204bd3ffc6d0186
Fix dumping of outer joins with empty qual lists.

Normally, a JoinExpr would have empty "quals" only if it came from CROSS
JOIN syntax.  However, it's possible to get to this state by specifying
NATURAL JOIN between two tables with no common column names, and there
might be other ways too.  The code previously printed no ON clause if
"quals" was empty; that's right for CROSS JOIN but syntactically invalid
if it's some type of outer join.  Fix by printing ON TRUE in that case.

This got broken by commit 2ffa740be, which stopped using NATURAL JOIN
syntax in ruleutils output due to its brittleness in the face of
column renamings.  Back-patch to 9.3 where that commit appeared.

Per report from Tushar Ahuja.

Discussion: https://postgr.es/m/98b283cd-6dda-5d3f-f8ac-87db8c76a3da@enterprisedb.com
src/backend/utils/adt/ruleutils.c
src/test/regress/expected/create_view.out
src/test/regress/sql/create_view.sql