Resolve failures in rules tests by adding T_CteScan to execRemote.c
authorTomas Vondra <[email protected]>
Sun, 19 Mar 2017 00:56:08 +0000 (01:56 +0100)
committerTomas Vondra <[email protected]>
Sun, 19 Mar 2017 00:56:08 +0000 (01:56 +0100)
The switch in determine_param_types() was missing T_CteScan case,
so some queries were failing with:

    ERROR: unrecognized node type: 119

This fixes it, and it also fixes the expected output for a few other
queries in the same test suite.

src/backend/pgxc/pool/execRemote.c
src/test/regress/expected/rules.out

index 8141daf14b0f9c89635cb4d5f11b5987f001ae4e..321fa1fee2c69ca132de8cfa3672375e912c4f46 100644 (file)
@@ -4987,6 +4987,7 @@ determine_param_types(Plan *plan,  struct find_params_context *context)
 
                case T_SeqScan:
                case T_SampleScan:
+               case T_CteScan:
                        break;
 
                case T_IndexScan:
index e7b1fe14b622d6e7f4484e222b9ea1963cbfc96a..40d6060eafd926150f32c76dce053ca1bfda299b 100644 (file)
@@ -3047,6 +3047,12 @@ WITH data(hat_name, hat_color) AS (
 INSERT INTO hats
     SELECT * FROM data
 RETURNING *;
+  hat_name  | hat_color  
+------------+------------
+ h8         | green     
+ h9         | blue      
+(2 rows)
+
 EXPLAIN (nodes off, costs off) WITH data(hat_name, hat_color) AS (
     VALUES ('h8', 'green'),
         ('h9', 'blue'),
@@ -3055,13 +3061,13 @@ EXPLAIN (nodes off, costs off) WITH data(hat_name, hat_color) AS (
 INSERT INTO hats
     SELECT * FROM data
 RETURNING *;
-                              QUERY PLAN                              
-----------------------------------------------------------------------
+                                              QUERY PLAN                                               
+-------------------------------------------------------------------------------------------------------
  Remote Subquery Scan on all
    ->  Insert on hat_data
          Conflict Resolution: UPDATE
          Conflict Arbiter Indexes: hat_data_unique_idx
-         Conflict Filter: (excluded.hat_color <> 'forbidden'::bpchar)
+         Conflict Filter: ((excluded.hat_color <> 'forbidden'::bpchar) AND (hat_data.* <> excluded.*))
          CTE data
            ->  Values Scan on "*VALUES*"
          ->  Remote Subquery Scan on all
@@ -3073,8 +3079,9 @@ SELECT * FROM hat_data WHERE hat_name IN ('h8', 'h9', 'h7') ORDER BY hat_name;
   hat_name  | hat_color  
 ------------+------------
  h7         | black     
- h8         | white     
-(2 rows)
+ h8         | green     
+ h9         | blue      
+(3 rows)
 
 DROP RULE hat_upsert ON hats;
 drop table hats;