1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix an obscure problem with "INSERT INTO tbl(cols) SELECT" statements where the SELECT is a compound with an ORDER BY and "cols" is a strict subset of tbl's columns.

FossilOrigin-Name: 718d5d0eab045a874107e078a857226a80ab912d
This commit is contained in:
dan
2015-04-21 15:49:04 +00:00
parent 7c052da54d
commit 4b79bde7a2
4 changed files with 30 additions and 10 deletions

View File

@ -16,6 +16,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix insert2
# Create some tables with data that we can select against
#
@ -275,4 +276,23 @@ ifcapable subquery {
} {1 2 1 3 1 4}
}
do_execsql_test 6.0 {
CREATE TABLE t5(a, b, c DEFAULT 'c', d);
}
do_execsql_test 6.1 {
INSERT INTO t5(a) SELECT 456 UNION ALL SELECT 123 ORDER BY 1;
SELECT * FROM t5 ORDER BY rowid;
} {123 {} c {} 456 {} c {}}
ifcapable fts3 {
do_execsql_test 6.2 {
CREATE VIRTUAL TABLE t0 USING fts4(a);
}
do_execsql_test 6.3 {
INSERT INTO t0 SELECT 0 UNION SELECT 0 AS 'x' ORDER BY x;
SELECT * FROM t0;
} {0}
}
finish_test