]> granicus.if.org Git - postgresql/commitdiff
Fix omission of locations in outfuncs/readfuncs partitioning node support.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 30 May 2017 15:32:41 +0000 (11:32 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 30 May 2017 15:32:41 +0000 (11:32 -0400)
We could have limped along without this for v10, which was my intention
when I annotated the bug in commit 76a3df6e5.  But consensus is that it's
better to fix it now and take the cost of a post-beta1 initdb (which is
needed because these node types are stored in pg_class.relpartbound).

Since we're forcing initdb anyway, take the opportunity to make the node
type identification strings match the node struct names, instead of being
randomly different from them.

Discussion: https://postgr.es/m/E1dFBEX-0004wt-8t@gemulon.postgresql.org

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

index 9189c8d43f8716eac6398b79f1976cf34e3195c5..c348bdcde39e37edabc625900af3767c7ddbe4ed 100644 (file)
@@ -3530,7 +3530,7 @@ _outPartitionElem(StringInfo str, const PartitionElem *node)
 static void
 _outPartitionSpec(StringInfo str, const PartitionSpec *node)
 {
-       WRITE_NODE_TYPE("PARTITIONBY");
+       WRITE_NODE_TYPE("PARTITIONSPEC");
 
        WRITE_STRING_FIELD(strategy);
        WRITE_NODE_FIELD(partParams);
@@ -3540,23 +3540,23 @@ _outPartitionSpec(StringInfo str, const PartitionSpec *node)
 static void
 _outPartitionBoundSpec(StringInfo str, const PartitionBoundSpec *node)
 {
-       WRITE_NODE_TYPE("PARTITIONBOUND");
+       WRITE_NODE_TYPE("PARTITIONBOUNDSPEC");
 
        WRITE_CHAR_FIELD(strategy);
        WRITE_NODE_FIELD(listdatums);
        WRITE_NODE_FIELD(lowerdatums);
        WRITE_NODE_FIELD(upperdatums);
-       /* XXX somebody forgot location field; too late to change for v10 */
+       WRITE_LOCATION_FIELD(location);
 }
 
 static void
 _outPartitionRangeDatum(StringInfo str, const PartitionRangeDatum *node)
 {
-       WRITE_NODE_TYPE("PARTRANGEDATUM");
+       WRITE_NODE_TYPE("PARTITIONRANGEDATUM");
 
        WRITE_BOOL_FIELD(infinite);
        WRITE_NODE_FIELD(value);
-       /* XXX somebody forgot location field; too late to change for v10 */
+       WRITE_LOCATION_FIELD(location);
 }
 
 /*
index b59ebd63ecb379bd16bb0b10bbb5b8ffd214c6a1..81ddfc32712e51237e3d2beed0b0e1e255397d9d 100644 (file)
@@ -2376,8 +2376,7 @@ _readPartitionBoundSpec(void)
        READ_NODE_FIELD(listdatums);
        READ_NODE_FIELD(lowerdatums);
        READ_NODE_FIELD(upperdatums);
-       /* XXX somebody forgot location field; too late to change for v10 */
-       local_node->location = -1;
+       READ_LOCATION_FIELD(location);
 
        READ_DONE();
 }
@@ -2392,8 +2391,7 @@ _readPartitionRangeDatum(void)
 
        READ_BOOL_FIELD(infinite);
        READ_NODE_FIELD(value);
-       /* XXX somebody forgot location field; too late to change for v10 */
-       local_node->location = -1;
+       READ_LOCATION_FIELD(location);
 
        READ_DONE();
 }
@@ -2638,9 +2636,9 @@ parseNodeString(void)
                return_value = _readAlternativeSubPlan();
        else if (MATCH("EXTENSIBLENODE", 14))
                return_value = _readExtensibleNode();
-       else if (MATCH("PARTITIONBOUND", 14))
+       else if (MATCH("PARTITIONBOUNDSPEC", 18))
                return_value = _readPartitionBoundSpec();
-       else if (MATCH("PARTRANGEDATUM", 14))
+       else if (MATCH("PARTITIONRANGEDATUM", 19))
                return_value = _readPartitionRangeDatum();
        else
        {
index 06fff799af3ba40618a7ce807af4a1227580fb11..00b835834b4a963deec317bfc8dc8d0d925cc011 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     201705141
+#define CATALOG_VERSION_NO     201705301
 
 #endif