From 66580f42cf0811ffda470f652130b125caae0855 Mon Sep 17 00:00:00 2001 From: Nikita Sivukhin Date: Wed, 16 Jul 2025 11:23:32 +0400 Subject: [PATCH] add test --- testing/insert.test | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/testing/insert.test b/testing/insert.test index 25224a026..b6de8205e 100755 --- a/testing/insert.test +++ b/testing/insert.test @@ -458,3 +458,26 @@ do_execsql_test_skip_lines_on_specific_db 1 {:memory:} double-quote-inner-quotes SELECT id, content FROM inner_quotes_test ORDER BY id; } {1|"foo" 2|'bar'} + +# regression test for incorrect order of column in insert +do_execsql_test_on_specific_db {:memory:} insert-tricky-column-order-values { + create table t(x, y, z); + insert into t(z, x) values (1, 2), (3, 4); + insert into t(y, z) values (5, 6), (7, 8); + select * from t; +} {2||1 +4||3 +|5|6 +|7|8} + +do_execsql_test_on_specific_db {:memory:} insert-tricky-column-order-table { + create table t(x, y, z); + create table q(x, y, z); + insert into q values (1, 2, 3), (4, 5, 6); + insert into t(z, x) select y, x from q; + insert into t(y, z) select z, y from q; + select * from t; +} {1||2 +4||5 +|3|2 +|6|5}