pgsql: Fix WITH attached to a nested set operation (UNION/INTERSECT/EXC

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix WITH attached to a nested set operation (UNION/INTERSECT/EXC
Date: 2012-07-31 21:57:12
Message-ID: E1SwKRE-0002N8-Ff@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/1e14aa6e30b3bee7ae71ebb15452334de9954a22

Modified Files
--------------
src/backend/parser/analyze.c | 21 ++++++++------
src/backend/parser/parse_cte.c | 15 ++++++++++-
src/test/regress/expected/with.out | 51 ++++++++++++++++++++++++++++++++++++
src/test/regress/sql/with.sql | 35 ++++++++++++++++++++++++
4 files changed, 112 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2012-08-01 04:41:57 pgsql: Add documentation cross-reference for JSON functions.
Previous Message Tom Lane 2012-07-31 18:38:02 pgsql: Fix syslogger so that log_truncate_on_rotation works in the firs