should be it

This commit is contained in:
2025-10-24 19:21:19 -05:00
parent a4b23fc57c
commit f09560c7b1
14047 changed files with 3161551 additions and 1 deletions

View File

@@ -0,0 +1,56 @@
# name: test/sql/upsert/upsert_set_expressions.test
# group: [upsert]
statement ok
pragma enable_verification;
# Create a table with only 1 non-indexed column
statement ok
create or replace table tbl(
i integer PRIMARY KEY,
j integer UNIQUE,
k integer
);
# Add 3 rows
statement ok
insert into tbl VALUES
(1, 10, 1),
(2, 20, 1),
(3, 30, 2);
# the 'i' column is indexed on and 3 already exists, causes a conflict
# this updates 'k' to 5
statement ok
insert into tbl VALUES (3,5,1) ON CONFLICT (i) DO UPDATE SET k = 5;
query III
select * from tbl;
----
1 10 1
2 20 1
3 30 5
# the 'i' column is indexed on and 3 already exists, causes a conflict
# this updates 'k' to 1 + excluded.k
statement ok
insert into tbl VALUES (3,5,1) ON CONFLICT (i) DO UPDATE SET k = 1 + excluded.k;
query III
select * from tbl;
----
1 10 1
2 20 1
3 30 2
# the 'i' column is indexed on and 3 already exists, causes a conflict
# this updates 'k' to k + excluded.k
statement ok
insert into tbl VALUES (3,5,1) ON CONFLICT (i) DO UPDATE SET k = k + excluded.k;
query III
select * from tbl;
----
1 10 1
2 20 1
3 30 3