Merge 'translate/upsert: fix explicit conflict target of non-rowid primary key in UPSERT' from Preston Thorpe

closes #3384

Closes #3386
This commit is contained in:
Preston Thorpe
2025-09-29 11:09:29 -04:00
committed by GitHub
2 changed files with 27 additions and 19 deletions

View File

@@ -337,6 +337,14 @@ do_execsql_test_on_specific_db {:memory:} upsert-doubly-qualified-target {
SELECT * FROM dq;
} {1|new}
# https://github.com/tursodatabase/turso/issues/3384
do_execsql_test_on_specific_db {:memory:} upsert-non-rowid-pk-target {
create table phonebook(name text primary key, phonenumber text, validDate date);
insert into phonebook values ('Alice','704-545-3333','2018-10-10');
insert into phonebook values ('Alice','704-111-1111','2018-10-20') on conflict (name) do update set phonenumber=excluded.phonenumber, validDate=excluded.validDate;
SELECT phonenumber, validDate FROM phonebook;
} {704-111-1111|2018-10-20}
# TODO: uncomment these when we support collations in indexes
# (right now it errors on Parse Error: cannot use expressions in CREATE INDEX)