diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-11-20 17:37:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 17:37:57 +0000 |
commit | f76323e9b295c15751e51e3443aa47a36bee8023 (patch) | |
tree | 4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/postgresql/cases/update.sql | |
parent | 753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff) | |
parent | a7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff) | |
download | ydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz |
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'yql/essentials/tests/postgresql/cases/update.sql')
-rw-r--r-- | yql/essentials/tests/postgresql/cases/update.sql | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/yql/essentials/tests/postgresql/cases/update.sql b/yql/essentials/tests/postgresql/cases/update.sql new file mode 100644 index 0000000000..bb17fb332b --- /dev/null +++ b/yql/essentials/tests/postgresql/cases/update.sql @@ -0,0 +1,43 @@ +-- +-- UPDATE syntax tests +-- +CREATE TABLE update_test ( + a INT DEFAULT 10, + b INT, + c TEXT +); +CREATE TABLE upsert_test ( + a INT PRIMARY KEY, + b TEXT +); +INSERT INTO update_test VALUES (5, 10, 'foo'); +INSERT INTO update_test(b, a) VALUES (15, 10); +SELECT * FROM update_test; +-- +-- Test multiple-set-clause syntax +-- +INSERT INTO update_test SELECT a,b+1,c FROM update_test; +-- Test ON CONFLICT DO UPDATE +INSERT INTO upsert_test VALUES(1, 'Boo'), (3, 'Zoo'); +DROP TABLE update_test; +DROP TABLE upsert_test; +CREATE TABLE upsert_test_2 (b TEXT, a INT PRIMARY KEY); +-- Create partitions intentionally in descending bound order, so as to test +-- that update-row-movement works with the leaf partitions not in bound order. +CREATE TABLE part_b_20_b_30 (e varchar, c numeric, a text, b bigint, d int); +CREATE TABLE part_c_1_100 (e varchar, d int, c numeric, b bigint, a text); +\set init_range_parted 'truncate range_parted; insert into range_parted VALUES (''a'', 1, 1, 1), (''a'', 10, 200, 1), (''b'', 12, 96, 1), (''b'', 13, 97, 2), (''b'', 15, 105, 16), (''b'', 17, 105, 19)' +\set show_data 'select tableoid::regclass::text COLLATE "C" partname, * from range_parted ORDER BY 1, 2, 3, 4, 5, 6' +-- Common table needed for multiple test scenarios. +CREATE TABLE mintab(c1 int); +INSERT into mintab VALUES (120); +DROP TABLE mintab; +CREATE TABLE sub_part1(b int, c int8, a numeric); +CREATE TABLE sub_part2(b int, c int8, a numeric); +CREATE TABLE list_part1(a numeric, b int, c int8); +-- UPDATE partition-key with FROM clause. If join produces multiple output +-- rows for the same row to be modified, we should tuple-route the row only +-- once. There should not be any rows inserted. +CREATE TABLE non_parted (id int); +INSERT into non_parted VALUES (1), (1), (1), (2), (2), (2), (3), (3), (3); +DROP TABLE non_parted; |