3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.
13 # This file implements tests to verify that ticket #1444 has been
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 ifcapable !compound||!view {
25 # The use of a VIEW that contained an ORDER BY clause within a UNION ALL
26 # was causing problems. See ticket #1444.
30 CREATE TABLE DemoTable (x INTEGER, TextKey TEXT, DKey Real);
31 CREATE INDEX DemoTableIdx ON DemoTable (TextKey);
32 INSERT INTO DemoTable VALUES(9,8,7);
33 INSERT INTO DemoTable VALUES(1,2,3);
34 CREATE VIEW DemoView AS SELECT * FROM DemoTable ORDER BY TextKey;
35 SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1;
37 } {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0}
40 SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView;
42 } {9 8 7.0 1 2 3.0 1 2 3.0 9 8 7.0}
46 CREATE VIEW DemoView AS SELECT * FROM DemoTable;
47 SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1;
49 } {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0}
52 SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView;
54 } {9 8 7.0 1 2 3.0 9 8 7.0 1 2 3.0}