mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-06 09:44:21 +01:00
fix backwards compatible rowid alias behaviour
This commit is contained in:
@@ -678,4 +678,20 @@ do_execsql_test_on_specific_db {:memory:} insert-rowid-select-rowid-success {
|
||||
INSERT INTO t(a) SELECT rowid FROM t;
|
||||
SELECT * FROM t;
|
||||
} {2
|
||||
1}
|
||||
1}
|
||||
|
||||
|
||||
# Due to a bug in SQLite, this check is needed to maintain backwards compatibility with rowid alias
|
||||
# SQLite docs: https://sqlite.org/lang_createtable.html#rowids_and_the_integer_primary_key
|
||||
# Issue: https://github.com/tursodatabase/turso/issues/3665
|
||||
do_execsql_test_on_specific_db {:memory:} insert-rowid-backwards-compability {
|
||||
CREATE TABLE t(a INTEGER PRIMARY KEY DESC);
|
||||
INSERT INTO t(a) VALUES (123);
|
||||
SELECT rowid, * FROM t;
|
||||
} {1|123}
|
||||
|
||||
do_execsql_test_on_specific_db {:memory:} insert-rowid-backwards-compability-2 {
|
||||
CREATE TABLE t(a INTEGER, PRIMARY KEY (a DESC));
|
||||
INSERT INTO t(a) VALUES (123);
|
||||
SELECT rowid, * FROM t;
|
||||
} {123|123}
|
||||
Reference in New Issue
Block a user