]> granicus.if.org Git - postgresql/commit
Fix WITH attached to a nested set operation (UNION/INTERSECT/EXCEPT).
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 Jul 2012 21:56:21 +0000 (17:56 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 Jul 2012 21:56:21 +0000 (17:56 -0400)
commitf6ce81f55a3c6932d5f88bc89374f404688f054e
treebc5fc3caa565d7c9c2f72eb8656246be3ef21c07
parentb76356ac22d8322e6074981b4d34ee19cd0dbc8a
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.
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/nodeFuncs.c
src/backend/nodes/outfuncs.c
src/backend/parser/analyze.c
src/backend/parser/parse_cte.c
src/backend/parser/parse_type.c
src/include/nodes/parsenodes.h
src/test/regress/expected/with.out
src/test/regress/sql/with.sql