aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/postgresql/cases/update.sql
diff options
context:
space:
mode:
authorudovichenko-r <udovichenko-r@yandex-team.com>2024-11-19 14:11:52 +0300
committerudovichenko-r <udovichenko-r@yandex-team.com>2024-11-19 14:22:01 +0300
commit72b3cd51dc3fb9d16975d353ea82fd85701393cc (patch)
tree318141940b8bf6bdb37ad6154e745e2ebfe3613f /yql/essentials/tests/postgresql/cases/update.sql
parent223625eed56ec3e2808c010eac46dba1c9a64d13 (diff)
downloadydb-72b3cd51dc3fb9d16975d353ea82fd85701393cc.tar.gz
YQL-19206 Move contrib/ydb/library/yql/tests/postgresql -> yql/essentials/tests/postgresql
commit_hash:46fdf59714b20cf2b61233a06e58365227d3c8b2
Diffstat (limited to 'yql/essentials/tests/postgresql/cases/update.sql')
-rw-r--r--yql/essentials/tests/postgresql/cases/update.sql43
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;