Fix tablesample handling which was broken during the merge
authorPavan Deolasee <[email protected]>
Wed, 26 Oct 2016 05:58:42 +0000 (11:28 +0530)
committerPavan Deolasee <[email protected]>
Wed, 26 Oct 2016 05:58:42 +0000 (11:28 +0530)
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/pgxc/pool/execRemote.c

index 6458e7596cb2503d9fddd4bd965462b9ee72d3e3..7d0196a5121eb5562deee261ac1206bee8e2476e 100644 (file)
@@ -719,6 +719,16 @@ _outSeqScan(StringInfo str, const SeqScan *node)
        _outScanInfo(str, (const Scan *) node);
 }
 
+static void
+_outSampleScan(StringInfo str, const SampleScan *node)
+{
+       WRITE_NODE_TYPE("SAMPLESCAN");
+
+       _outScanInfo(str, (const Scan *) node);
+
+       WRITE_NODE_FIELD(tablesample);
+}
+
 static void
 _outIndexScan(StringInfo str, const IndexScan *node)
 {
@@ -3661,7 +3671,18 @@ _outTableSampleClause(StringInfo str, const TableSampleClause *node)
 {
        WRITE_NODE_TYPE("TABLESAMPLECLAUSE");
 
+#ifdef XCP
+       if (portable_output)
+       {
+               WRITE_FUNCID_FIELD(tsmhandler);
+       }
+       else
+       {
+#endif
        WRITE_OID_FIELD(tsmhandler);
+#ifdef XCP
+       }
+#endif
        WRITE_NODE_FIELD(args);
        WRITE_NODE_FIELD(repeatable);
 }
@@ -4091,6 +4112,9 @@ _outNode(StringInfo str, const void *obj)
                                _outRemoteQuery(str, obj);
                                break;
 #endif
+                       case T_SampleScan:
+                               _outSampleScan(str, obj);
+                               break;
                        case T_IndexScan:
                                _outIndexScan(str, obj);
                                break;
index 8da251651807519783e65d0d6e19fcf83616e696..b32f16d7ffeb0ef2ff2e58b3b1c7b7906cc4cfdd 100644 (file)
@@ -2050,7 +2050,18 @@ _readTableSampleClause(void)
 {
        READ_LOCALS(TableSampleClause);
 
+#ifdef XCP
+       if (portable_input)
+       {
+               READ_FUNCID_FIELD(tsmhandler);
+       }
+       else
+       {
+#endif
        READ_OID_FIELD(tsmhandler);
+#ifdef XCP
+       }
+#endif
        READ_NODE_FIELD(args);
        READ_NODE_FIELD(repeatable);
 
@@ -2325,6 +2336,17 @@ _readSeqScan(void)
        READ_DONE();
 }
 
+/*
+ * _readSampleScan
+ */
+static SampleScan *
+_readSampleScan(void)
+{
+       READ_SCAN_FIELDS(SampleScan);
+       READ_NODE_FIELD(tablesample);
+
+       READ_DONE();
+}
 
 /*
  * _readIndexScan
@@ -3546,6 +3568,8 @@ parseNodeString(void)
                return_value = _readScan();
        else if (MATCH("SEQSCAN", 7))
                return_value = _readSeqScan();
+       else if (MATCH("SAMPLESCAN", 10))
+               return_value = _readSampleScan();
        else if (MATCH("INDEXSCAN", 9))
                return_value = _readIndexScan();
        else if (MATCH("INDEXONLYSCAN", 13))
index 31568660f0b2f3e7e73d9b0f0d34fb8f43eb3ce8..105b4ebf05a659f3b3a1dfaa34e98bb99a298c55 100644 (file)
@@ -4986,6 +4986,7 @@ determine_param_types(Plan *plan,  struct find_params_context *context)
                        break;
 
                case T_SeqScan:
+               case T_SampleScan:
                        break;
 
                case T_IndexScan: