From f6ce81f55a3c6932d5f88bc89374f404688f054e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 31 Jul 2012 17:56:21 -0400 Subject: 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/include/nodes/parsenodes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/include/nodes/parsenodes.h') diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 1f89cd51595..119e1ed2f6e 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -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. -- cgit v1.2.3