Skip to content

Commit 4158cc3

Browse files
committed
Do not write out WCOs in Query
The WithCheckOptions list in Query are only populated during rewrite and do not need to be written out or read in as part of a Query structure. Further, move WithCheckOptions to the bottom and add comments to clarify that it is only populated during rewrite. Back-patch to 9.5 with a catversion bump, as we are still in alpha.
1 parent 2596d70 commit 4158cc3

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/backend/nodes/copyfuncs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2725,7 +2725,6 @@ _copyQuery(const Query *from)
27252725
COPY_NODE_FIELD(rtable);
27262726
COPY_NODE_FIELD(jointree);
27272727
COPY_NODE_FIELD(targetList);
2728-
COPY_NODE_FIELD(withCheckOptions);
27292728
COPY_NODE_FIELD(onConflict);
27302729
COPY_NODE_FIELD(returningList);
27312730
COPY_NODE_FIELD(groupClause);
@@ -2739,6 +2738,7 @@ _copyQuery(const Query *from)
27392738
COPY_NODE_FIELD(rowMarks);
27402739
COPY_NODE_FIELD(setOperations);
27412740
COPY_NODE_FIELD(constraintDeps);
2741+
COPY_NODE_FIELD(withCheckOptions);
27422742

27432743
return newnode;
27442744
}

src/backend/nodes/equalfuncs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,6 @@ _equalQuery(const Query *a, const Query *b)
906906
COMPARE_NODE_FIELD(rtable);
907907
COMPARE_NODE_FIELD(jointree);
908908
COMPARE_NODE_FIELD(targetList);
909-
COMPARE_NODE_FIELD(withCheckOptions);
910909
COMPARE_NODE_FIELD(onConflict);
911910
COMPARE_NODE_FIELD(returningList);
912911
COMPARE_NODE_FIELD(groupClause);
@@ -920,6 +919,7 @@ _equalQuery(const Query *a, const Query *b)
920919
COMPARE_NODE_FIELD(rowMarks);
921920
COMPARE_NODE_FIELD(setOperations);
922921
COMPARE_NODE_FIELD(constraintDeps);
922+
COMPARE_NODE_FIELD(withCheckOptions);
923923

924924
return true;
925925
}

src/backend/nodes/outfuncs.c

-1
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,6 @@ _outQuery(StringInfo str, const Query *node)
23972397
WRITE_NODE_FIELD(rtable);
23982398
WRITE_NODE_FIELD(jointree);
23992399
WRITE_NODE_FIELD(targetList);
2400-
WRITE_NODE_FIELD(withCheckOptions);
24012400
WRITE_NODE_FIELD(onConflict);
24022401
WRITE_NODE_FIELD(returningList);
24032402
WRITE_NODE_FIELD(groupClause);

src/backend/nodes/readfuncs.c

-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ _readQuery(void)
244244
READ_NODE_FIELD(rtable);
245245
READ_NODE_FIELD(jointree);
246246
READ_NODE_FIELD(targetList);
247-
READ_NODE_FIELD(withCheckOptions);
248247
READ_NODE_FIELD(onConflict);
249248
READ_NODE_FIELD(returningList);
250249
READ_NODE_FIELD(groupClause);

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201510042
56+
#define CATALOG_VERSION_NO 201510052
5757

5858
#endif

src/include/nodes/parsenodes.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ typedef struct Query
130130

131131
List *targetList; /* target list (of TargetEntry) */
132132

133-
List *withCheckOptions; /* a list of WithCheckOption's */
134-
135133
OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */
136134

137135
List *returningList; /* return-values list (of TargetEntry) */
@@ -158,6 +156,10 @@ typedef struct Query
158156

159157
List *constraintDeps; /* a list of pg_constraint OIDs that the query
160158
* depends on to be semantically valid */
159+
160+
List *withCheckOptions; /* a list of WithCheckOption's, which are
161+
* only added during rewrite and therefore
162+
* are not written out as part of Query. */
161163
} Query;
162164

163165

0 commit comments

Comments
 (0)