Do not write out WCOs in Query
authorStephen Frost
Mon, 5 Oct 2015 11:38:56 +0000 (07:38 -0400)
committerStephen Frost
Mon, 5 Oct 2015 11:38:56 +0000 (07:38 -0400)
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.

src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/include/catalog/catversion.h
src/include/nodes/parsenodes.h

index 37d88777562e3d09da66341e4c1f6781ee3e10db..73240406bafc29437ef74267d7cc7ee756c86b76 100644 (file)
@@ -2701,7 +2701,6 @@ _copyQuery(const Query *from)
    COPY_NODE_FIELD(rtable);
    COPY_NODE_FIELD(jointree);
    COPY_NODE_FIELD(targetList);
-   COPY_NODE_FIELD(withCheckOptions);
    COPY_NODE_FIELD(onConflict);
    COPY_NODE_FIELD(returningList);
    COPY_NODE_FIELD(groupClause);
@@ -2715,6 +2714,7 @@ _copyQuery(const Query *from)
    COPY_NODE_FIELD(rowMarks);
    COPY_NODE_FIELD(setOperations);
    COPY_NODE_FIELD(constraintDeps);
+   COPY_NODE_FIELD(withCheckOptions);
 
    return newnode;
 }
index d91271a862e754ed5d2c1f15a458e031008e76ca..fcdb3d02837b2d262e9c65b350318975677591d1 100644 (file)
@@ -906,7 +906,6 @@ _equalQuery(const Query *a, const Query *b)
    COMPARE_NODE_FIELD(rtable);
    COMPARE_NODE_FIELD(jointree);
    COMPARE_NODE_FIELD(targetList);
-   COMPARE_NODE_FIELD(withCheckOptions);
    COMPARE_NODE_FIELD(onConflict);
    COMPARE_NODE_FIELD(returningList);
    COMPARE_NODE_FIELD(groupClause);
@@ -920,6 +919,7 @@ _equalQuery(const Query *a, const Query *b)
    COMPARE_NODE_FIELD(rowMarks);
    COMPARE_NODE_FIELD(setOperations);
    COMPARE_NODE_FIELD(constraintDeps);
+   COMPARE_NODE_FIELD(withCheckOptions);
 
    return true;
 }
index 45e3effd4c9cc9aaa54c28d25c5717ed3eb6a0f0..991b4c217565728e254f220e01efa769e5e6d5d6 100644 (file)
@@ -2379,7 +2379,6 @@ _outQuery(StringInfo str, const Query *node)
    WRITE_NODE_FIELD(rtable);
    WRITE_NODE_FIELD(jointree);
    WRITE_NODE_FIELD(targetList);
-   WRITE_NODE_FIELD(withCheckOptions);
    WRITE_NODE_FIELD(onConflict);
    WRITE_NODE_FIELD(returningList);
    WRITE_NODE_FIELD(groupClause);
index df55b76c2520e575486c0b6c37aed7a6acd8baf1..32b23fff097ca576e20f928ed8da3b2b6437600a 100644 (file)
@@ -213,7 +213,6 @@ _readQuery(void)
    READ_NODE_FIELD(rtable);
    READ_NODE_FIELD(jointree);
    READ_NODE_FIELD(targetList);
-   READ_NODE_FIELD(withCheckOptions);
    READ_NODE_FIELD(onConflict);
    READ_NODE_FIELD(returningList);
    READ_NODE_FIELD(groupClause);
index 768bc1fa505a036a3d4dbe9049f3a3171618dae8..e3b567a0e3ab88f0b8e2bcf63a724bf318483937 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 201510041
+#define CATALOG_VERSION_NO 201510051
 
 #endif
index 18bb075b3f34057d321cda404e1cf36fc1718555..4a198420abc5e5ca6e6a3a6e8cb1e5d66336ac8f 100644 (file)
@@ -130,8 +130,6 @@ typedef struct Query
 
    List       *targetList;     /* target list (of TargetEntry) */
 
-   List       *withCheckOptions;       /* a list of WithCheckOption's */
-
    OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */
 
    List       *returningList;  /* return-values list (of TargetEntry) */
@@ -158,6 +156,10 @@ typedef struct Query
 
    List       *constraintDeps; /* a list of pg_constraint OIDs that the query
                                 * depends on to be semantically valid */
+
+   List       *withCheckOptions;   /* a list of WithCheckOption's, which are
+                                    * only added during rewrite and therefore
+                                    * are not written out as part of Query. */
 } Query;