sl@0: # 2005 September 19 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file implements regression tests for SQLite library. sl@0: # sl@0: # This file implements tests to verify that ticket #1444 has been sl@0: # fixed. sl@0: # sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: ifcapable !compound||!view { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: # The use of a VIEW that contained an ORDER BY clause within a UNION ALL sl@0: # was causing problems. See ticket #1444. sl@0: # sl@0: do_test tkt1444-1.1 { sl@0: execsql { sl@0: CREATE TABLE DemoTable (x INTEGER, TextKey TEXT, DKey Real); sl@0: CREATE INDEX DemoTableIdx ON DemoTable (TextKey); sl@0: INSERT INTO DemoTable VALUES(9,8,7); sl@0: INSERT INTO DemoTable VALUES(1,2,3); sl@0: CREATE VIEW DemoView AS SELECT * FROM DemoTable ORDER BY TextKey; sl@0: SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1; sl@0: } sl@0: } {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0} sl@0: do_test tkt1444-1.2 { sl@0: execsql { sl@0: SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView; sl@0: } sl@0: } {9 8 7.0 1 2 3.0 1 2 3.0 9 8 7.0} sl@0: do_test tkt1444-1.3 { sl@0: execsql { sl@0: DROP VIEW DemoView; sl@0: CREATE VIEW DemoView AS SELECT * FROM DemoTable; sl@0: SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1; sl@0: } sl@0: } {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0} sl@0: do_test tkt1444-1.4 { sl@0: execsql { sl@0: SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView; sl@0: } sl@0: } {9 8 7.0 1 2 3.0 9 8 7.0 1 2 3.0} sl@0: sl@0: finish_test