Thread: pgsql: Preserve AND/OR flatness while extracting restriction OR clauses

pgsql: Preserve AND/OR flatness while extracting restriction OR clauses

From
Tom Lane
Date:
Preserve AND/OR flatness while extracting restriction OR clauses.

The code I added in commit f343a880d5555faf1dad0286c5632047c8f599ad was
careless about preserving AND/OR flatness: it could create a structure with
an OR node directly underneath another one.  That breaks an assumption
that's fairly important for planning efficiency, not to mention triggering
various Asserts (as reported by Benjamin Smith).  Add a trifle more logic
to handle the case properly.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f003419791f35eeab0150cd097bcf7929622b0fc

Modified Files
--------------
src/backend/optimizer/util/orclauses.c |   12 ++++++++++--
src/test/regress/expected/join.out     |   27 +++++++++++++++++++++++++++
src/test/regress/sql/join.sql          |    4 ++++
3 files changed, 41 insertions(+), 2 deletions(-)