pgsql: Fix WITH attached to a nested set operation (UNION/INTERSECT/EXC - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix WITH attached to a nested set operation (UNION/INTERSECT/EXC
Date
Msg-id E1SwKRE-0002N0-GL@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix WITH attached to a nested set operation (UNION/INTERSECT/EXCEPT).

Parse analysis neglected to cover the case of a WITH clause attached to an
intermediate-level set operation; it only handled WITH at the top level
or WITH attached to a leaf-level SELECT.  Per report from Adam Mackler.

In HEAD, I rearranged the order of SelectStmt's fields to put withClause
with the other fields that can appear on non-leaf SelectStmts.  In back
branches, leave it alone to avoid a possible ABI break for third-party
code.

Back-patch to 8.4 where WITH support was added.

Branch
------
master

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

Modified Files
--------------
src/backend/nodes/copyfuncs.c      |    2 +-
src/backend/nodes/equalfuncs.c     |    2 +-
src/backend/nodes/nodeFuncs.c      |    4 +-
src/backend/nodes/outfuncs.c       |    2 +-
src/backend/parser/analyze.c       |   29 +++++++++++---------
src/backend/parser/parse_cte.c     |   15 ++++++++++-
src/backend/parser/parse_type.c    |    2 +-
src/include/nodes/parsenodes.h     |    2 +-
src/test/regress/expected/with.out |   51 ++++++++++++++++++++++++++++++++++++
src/test/regress/sql/with.sql      |   35 ++++++++++++++++++++++++
10 files changed, 123 insertions(+), 21 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix WITH attached to a nested set operation (UNION/INTERSECT/EXC
Next
From: Tom Lane
Date:
Subject: pgsql: Fix WITH attached to a nested set operation (UNION/INTERSECT/EXC