mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
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.
This commit is contained in:
@@ -1016,7 +1016,6 @@ typedef struct SelectStmt
|
||||
List *groupClause; /* GROUP BY clauses */
|
||||
Node *havingClause; /* HAVING conditional-expression */
|
||||
List *windowClause; /* WINDOW window_name AS (...), ... */
|
||||
WithClause *withClause; /* WITH clause */
|
||||
|
||||
/*
|
||||
* In a "leaf" node representing a VALUES list, the above fields are all
|
||||
@@ -1036,6 +1035,7 @@ typedef struct SelectStmt
|
||||
Node *limitOffset; /* # of result tuples to skip */
|
||||
Node *limitCount; /* # of result tuples to return */
|
||||
List *lockingClause; /* FOR UPDATE (list of LockingClause's) */
|
||||
WithClause *withClause; /* WITH clause */
|
||||
|
||||
/*
|
||||
* These fields are used only in upper-level SelectStmts.
|
||||
|
Reference in New Issue
Block a user