some more

pull/7626/head
paragjain 2024-06-14 04:39:17 +00:00 committed by Teja Mupparti
parent 06e9c29950
commit 7c8a366ba2
3 changed files with 35 additions and 3 deletions

View File

@ -1965,8 +1965,8 @@ on t.id = s.somekey
WHEN NOT MATCHED THEN WHEN NOT MATCHED THEN
INSERT (id) INSERT (id)
VALUES (s.somekey); VALUES (s.somekey);
DEBUG: MERGE INSERT must use the source table distribution column value, try repartitioning DEBUG: MERGE INSERT must use the source table distribution column value for push down to workers. Otherwise, repartitioning will be applied
DEBUG: MERGE INSERT must use the source table distribution column value DEBUG: MERGE INSERT must use the source table distribution column value for push down to workers. Otherwise, repartitioning will be applied
DEBUG: Creating MERGE repartition plan DEBUG: Creating MERGE repartition plan
DEBUG: Using column - index:0 from the source list to redistribute DEBUG: Using column - index:0 from the source list to redistribute
QUERY PLAN QUERY PLAN
@ -2118,6 +2118,23 @@ SELECT * FROM target_table;
--------------------------------------------------------------------- ---------------------------------------------------------------------
(0 rows) (0 rows)
--
DELETE FROM source_withdata;
DELETE FROM target_table;
INSERT INTO source VALUES (1,1);
merge into target_table sda
using source_withdata sdn
on sda.id = sdn.id AND sda.id = 1
when not matched then
insert (id)
values (10000);
ERROR: MERGE INSERT is using unsupported expression type for distribution column
DETAIL: Inserting arbitrary values that don't correspond to the joined column values can lead to unpredictable outcomes where rows are incorrectly distributed among different shards
SELECT * FROM target_table WHERE id = 10000;
id | name
---------------------------------------------------------------------
(0 rows)
RESET client_min_messages; RESET client_min_messages;
-- This will prune shards with restriction information as NOT MATCHED is void -- This will prune shards with restriction information as NOT MATCHED is void
BEGIN; BEGIN;

View File

@ -116,7 +116,8 @@ test: function_with_case_when
test: clock test: clock
# MERGE tests # MERGE tests
test: merge pgmerge merge_repartition2 test: merge pgmerge
test: merge_repartition2
test: merge_repartition1 merge_schema_sharding test: merge_repartition1 merge_schema_sharding
test: merge_partition_tables test: merge_partition_tables

View File

@ -1308,6 +1308,20 @@ WHEN MATCHED THEN
-- let's verify if data deleted properly. -- let's verify if data deleted properly.
SELECT * FROM target_table; SELECT * FROM target_table;
--
DELETE FROM source_withdata;
DELETE FROM target_table;
INSERT INTO source VALUES (1,1);
merge into target_table sda
using source_withdata sdn
on sda.id = sdn.id AND sda.id = 1
when not matched then
insert (id)
values (10000);
SELECT * FROM target_table WHERE id = 10000;
RESET client_min_messages; RESET client_min_messages;