Skip to content

Commit

Permalink
adding one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
paragikjain committed Sep 13, 2024
1 parent dacc64b commit 1a3c676
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/test/regress/expected/merge_vcore.out
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,41 @@ SELECT * FROM TARGET;
1 | | 100000
(1 row)

DROP TABLE IF EXISTS source;
DROP TABLE IF EXISTS target;
-- Test 3
CREATE TABLE source (
id int,
age int,
salary int
);
CREATE TABLE target (
id int,
age int,
salary int
);
SELECT create_distributed_table('source', 'id', colocate_with=>'none');
create_distributed_table
---------------------------------------------------------------------

(1 row)

SELECT create_distributed_table('target', 'id', colocate_with=>'none');
create_distributed_table
---------------------------------------------------------------------

(1 row)

INSERT INTO source (id, age, salary) VALUES (1,30, 100000);
MERGE INTO ONLY target USING source ON (source.id = target.id)
WHEN NOT MATCHED THEN
INSERT (salary, id, age) VALUES (source.age, source.id, source.salary);
SELECT * FROM TARGET;
id | age | salary
---------------------------------------------------------------------
1 | 100000 | 30
(1 row)

DROP TABLE IF EXISTS source;
DROP TABLE IF EXISTS target;
DROP SCHEMA IF EXISTS merge_vcore_schema CASCADE;
27 changes: 27 additions & 0 deletions src/test/regress/sql/merge_vcore.sql
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,33 @@ DROP TABLE IF EXISTS source;
DROP TABLE IF EXISTS target;


-- Test 3
CREATE TABLE source (
id int,
age int,
salary int
);

CREATE TABLE target (
id int,
age int,
salary int
);

SELECT create_distributed_table('source', 'id', colocate_with=>'none');
SELECT create_distributed_table('target', 'id', colocate_with=>'none');

INSERT INTO source (id, age, salary) VALUES (1,30, 100000);

MERGE INTO ONLY target USING source ON (source.id = target.id)
WHEN NOT MATCHED THEN
INSERT (salary, id, age) VALUES (source.age, source.id, source.salary);

SELECT * FROM TARGET;
DROP TABLE IF EXISTS source;
DROP TABLE IF EXISTS target;



DROP SCHEMA IF EXISTS merge_vcore_schema CASCADE;

Expand Down

0 comments on commit 1a3c676

Please sign in to comment.