mirror of https://github.com/citusdata/citus.git
adding one more test
parent
dacc64b78c
commit
1a3c676c23
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue