summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2015-06-10 07:01:50 +0000
committerPavan Deolasee2015-06-10 07:01:50 +0000
commit6993afb01008f9d9b090d3c35e55a0ecbd9c8daf (patch)
treee17cf45af06ab71ccabc750b60094d6be94b5128
parent29e61a40c961dfcafdd3177a709ff2bad2193fe6 (diff)
Fix a few expected outputs related to plan changes for test case
insert_conflict. There are a few more differences which need to be addressed
-rw-r--r--src/test/regress/expected/insert_conflict.out309
1 files changed, 183 insertions, 126 deletions
diff --git a/src/test/regress/expected/insert_conflict.out b/src/test/regress/expected/insert_conflict.out
index eca9690592..10bb0e6c4d 100644
--- a/src/test/regress/expected/insert_conflict.out
+++ b/src/test/regress/expected/insert_conflict.out
@@ -17,92 +17,115 @@ explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on con
ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification
-- succeeds
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit) do nothing;
- QUERY PLAN
--------------------------------------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: op_index_key, collation_index_key, both_index_key
- -> Result
-(4 rows)
+ QUERY PLAN
+-------------------------------------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: op_index_key, collation_index_key, both_index_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit, key, fruit, key) do nothing;
- QUERY PLAN
--------------------------------------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: op_index_key, collation_index_key, both_index_key
- -> Result
-(4 rows)
+ QUERY PLAN
+-------------------------------------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: op_index_key, collation_index_key, both_index_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit), key, lower(fruit), key) do nothing;
- QUERY PLAN
--------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: both_index_expr_key
- -> Result
-(4 rows)
+ QUERY PLAN
+-------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: both_index_expr_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit) do update set fruit = excluded.fruit
where exists (select 1 from insertconflicttest ii where ii.key = excluded.key);
- QUERY PLAN
--------------------------------------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: UPDATE
- Conflict Arbiter Indexes: op_index_key, collation_index_key, both_index_key
- Conflict Filter: (alternatives: SubPlan 1 or hashed SubPlan 2)
- -> Result
- SubPlan 1
- -> Index Only Scan using both_index_expr_key on insertconflicttest ii
- Index Cond: (key = excluded.key)
- SubPlan 2
- -> Seq Scan on insertconflicttest ii_1
-(10 rows)
+ QUERY PLAN
+----------------------------------------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: UPDATE
+ Conflict Arbiter Indexes: op_index_key, collation_index_key, both_index_key
+ Conflict Filter: (SubPlan 1)
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+ SubPlan 1
+ -> Remote Subquery Scan on all (datanode_1,datanode_2)
+ -> Index Only Scan using both_index_expr_key on insertconflicttest ii
+ Index Cond: (key = excluded.key)
+(12 rows)
-- Neither collation nor operator class specifications are required --
-- supplying them merely *limits* matches to indexes with matching opclasses
-- used for relevant indexes
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit text_pattern_ops) do nothing;
- QUERY PLAN
-----------------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: op_index_key, both_index_key
- -> Result
-(4 rows)
+ QUERY PLAN
+----------------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: op_index_key, both_index_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
-- Okay, arbitrates using both index where text_pattern_ops opclass does and
-- does not appear.
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit collate "C") do nothing;
- QUERY PLAN
------------------------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: collation_index_key, both_index_key
- -> Result
-(4 rows)
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: collation_index_key, both_index_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
-- Okay, but only accepts the single index where both opclass and collation are
-- specified
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit collate "C" text_pattern_ops, key) do nothing;
- QUERY PLAN
---------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: both_index_key
- -> Result
-(4 rows)
+ QUERY PLAN
+--------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: both_index_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
-- Okay, but only accepts the single index where both opclass and collation are
-- specified (plus expression variant)
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit) collate "C", key, key) do nothing;
- QUERY PLAN
--------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: both_index_expr_key
- -> Result
-(4 rows)
+ QUERY PLAN
+-------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: both_index_expr_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
-- Attribute appears twice, while not all attributes/expressions on attributes
-- appearing within index definition match in terms of both opclass and
@@ -119,22 +142,28 @@ explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on con
-- cases. It rolls with unique indexes where attributes redundantly appear
-- multiple times, too (which is not tested here).
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit, key, fruit text_pattern_ops, key) do nothing;
- QUERY PLAN
-----------------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: op_index_key, both_index_key
- -> Result
-(4 rows)
+ QUERY PLAN
+----------------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: op_index_key, both_index_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit) collate "C" text_pattern_ops, key, key) do nothing;
- QUERY PLAN
--------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: NOTHING
- Conflict Arbiter Indexes: both_index_expr_key
- -> Result
-(4 rows)
+ QUERY PLAN
+-------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: NOTHING
+ Conflict Arbiter Indexes: both_index_expr_key
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
drop index op_index_key;
drop index collation_index_key;
@@ -148,58 +177,83 @@ create unique index key_index on insertconflicttest(key);
-- Explain tests
--
explain (costs off) insert into insertconflicttest values (0, 'Bilberry') on conflict (key) do update set fruit = excluded.fruit;
- QUERY PLAN
----------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: UPDATE
- Conflict Arbiter Indexes: key_index
- -> Result
-(4 rows)
+ QUERY PLAN
+------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: UPDATE
+ Conflict Arbiter Indexes: key_index
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(7 rows)
-- Should display qual actually attributable to internal sequential scan:
explain (costs off) insert into insertconflicttest values (0, 'Bilberry') on conflict (key) do update set fruit = excluded.fruit where insertconflicttest.fruit != 'Cawesh';
- QUERY PLAN
------------------------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: UPDATE
- Conflict Arbiter Indexes: key_index
- Conflict Filter: (insertconflicttest.fruit <> 'Cawesh'::text)
- -> Result
-(5 rows)
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: UPDATE
+ Conflict Arbiter Indexes: key_index
+ Conflict Filter: (insertconflicttest.fruit <> 'Cawesh'::text)
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(8 rows)
-- With EXCLUDED.* expression in scan node:
explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key) do update set fruit = excluded.fruit where excluded.fruit != 'Elderberry';
- QUERY PLAN
------------------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: UPDATE
- Conflict Arbiter Indexes: key_index
- Conflict Filter: (excluded.fruit <> 'Elderberry'::text)
- -> Result
-(5 rows)
+ QUERY PLAN
+-----------------------------------------------------------------
+ Remote Subquery Scan on all (datanode_2)
+ -> Insert on insertconflicttest
+ Conflict Resolution: UPDATE
+ Conflict Arbiter Indexes: key_index
+ Conflict Filter: (excluded.fruit <> 'Elderberry'::text)
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 0
+ -> Result
+(8 rows)
-- Does the same, but JSON format shows "Conflict Arbiter Index" as JSON array:
explain (costs off, format json) insert into insertconflicttest values (0, 'Bilberry') on conflict (key) do update set fruit = excluded.fruit where insertconflicttest.fruit != 'Lime' returning *;
- QUERY PLAN
-------------------------------------------------------------------------
- [ +
- { +
- "Plan": { +
- "Node Type": "ModifyTable", +
- "Operation": "Insert", +
- "Relation Name": "insertconflicttest", +
- "Alias": "insertconflicttest", +
- "Conflict Resolution": "UPDATE", +
- "Conflict Arbiter Indexes": ["key_index"], +
- "Conflict Filter": "(insertconflicttest.fruit <> 'Lime'::text)",+
- "Plans": [ +
- { +
- "Node Type": "Result", +
- "Parent Relationship": "Member" +
- } +
- ] +
- } +
- } +
+ QUERY PLAN
+----------------------------------------------------------------------------
+ [ +
+ { +
+ "Plan": { +
+ "Node Type": "Remote Subquery Scan", +
+ "Replicated": "no", +
+ "Node List": ["datanode_2"], +
+ "Plans": [ +
+ { +
+ "Node Type": "ModifyTable", +
+ "Operation": "Insert", +
+ "Parent Relationship": "Outer", +
+ "Relation Name": "insertconflicttest", +
+ "Alias": "insertconflicttest", +
+ "Conflict Resolution": "UPDATE", +
+ "Conflict Arbiter Indexes": ["key_index"], +
+ "Conflict Filter": "(insertconflicttest.fruit <> 'Lime'::text)",+
+ "Plans": [ +
+ { +
+ "Node Type": "Remote Subquery Scan", +
+ "Parent Relationship": "Member", +
+ "Replicated": "yes", +
+ "Node List": [], +
+ "Plans": [ +
+ { +
+ "Node Type": "Result", +
+ "Parent Relationship": "Outer" +
+ } +
+ ] +
+ } +
+ ] +
+ } +
+ ] +
+ } +
+ } +
]
(1 row)
@@ -314,13 +368,16 @@ insert into insertconflicttest values (24, 'Plum') on conflict (key, lower(fruit
insert into insertconflicttest values (25, 'Peach') on conflict (lower(fruit), key) do update set fruit = excluded.fruit;
-- Should not infer "tricky_expr_comp_key_index" index:
explain (costs off) insert into insertconflicttest values (26, 'Fig') on conflict (lower(fruit), key, lower(fruit), key) do update set fruit = excluded.fruit;
- QUERY PLAN
--------------------------------------------------
- Insert on insertconflicttest
- Conflict Resolution: UPDATE
- Conflict Arbiter Indexes: expr_comp_key_index
- -> Result
-(4 rows)
+ QUERY PLAN
+-------------------------------------------------------
+ Remote Subquery Scan on all (datanode_1)
+ -> Insert on insertconflicttest
+ Conflict Resolution: UPDATE
+ Conflict Arbiter Indexes: expr_comp_key_index
+ -> Remote Subquery Scan on local node
+ Distribute results by H: 26
+ -> Result
+(7 rows)
-- inference fails:
insert into insertconflicttest values (27, 'Prune') on conflict (key, upper(fruit)) do update set fruit = excluded.fruit;