Обсуждение: pgsql: Fix WITH attached to a nested set operation (UNION/INTERSECT/EXC

Поиск
Список
Период
Сортировка

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

От
Tom Lane
Дата:
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
------
REL9_0_STABLE

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

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