should be it
This commit is contained in:
37
external/duckdb/test/sql/upsert/upsert_unique_null.test
vendored
Normal file
37
external/duckdb/test/sql/upsert/upsert_unique_null.test
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# name: test/sql/upsert/upsert_unique_null.test
|
||||
# group: [upsert]
|
||||
|
||||
statement ok
|
||||
pragma enable_verification;
|
||||
|
||||
statement ok
|
||||
create or replace table tbl (
|
||||
a integer unique,
|
||||
b integer
|
||||
);
|
||||
|
||||
statement ok
|
||||
insert into tbl VALUES (3,2), (1,3);
|
||||
|
||||
statement ok
|
||||
insert into tbl(b) VALUES (5) ON CONFLICT (a) DO UPDATE SET b = 8;
|
||||
|
||||
# UNIQUE can be NULL, PRIMARY KEY can't be
|
||||
query II
|
||||
select * from tbl;
|
||||
----
|
||||
3 2
|
||||
1 3
|
||||
NULL 5
|
||||
|
||||
statement ok
|
||||
insert into tbl(b) VALUES (5) ON CONFLICT (a) DO UPDATE SET b = 8;
|
||||
|
||||
# And NULL does not take part in the UNIQUE Index, so it does not activate the ON CONFLICT clause
|
||||
query II
|
||||
select * from tbl;
|
||||
----
|
||||
3 2
|
||||
1 3
|
||||
NULL 5
|
||||
NULL 5
|
||||
Reference in New Issue
Block a user