sl@0
|
1 |
# 2005 September 19
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# The author disclaims copyright to this source code. In place of
|
sl@0
|
4 |
# a legal notice, here is a blessing:
|
sl@0
|
5 |
#
|
sl@0
|
6 |
# May you do good and not evil.
|
sl@0
|
7 |
# May you find forgiveness for yourself and forgive others.
|
sl@0
|
8 |
# May you share freely, never taking more than you give.
|
sl@0
|
9 |
#
|
sl@0
|
10 |
#***********************************************************************
|
sl@0
|
11 |
# This file implements regression tests for SQLite library.
|
sl@0
|
12 |
#
|
sl@0
|
13 |
# This file implements tests to verify that ticket #1444 has been
|
sl@0
|
14 |
# fixed.
|
sl@0
|
15 |
#
|
sl@0
|
16 |
|
sl@0
|
17 |
set testdir [file dirname $argv0]
|
sl@0
|
18 |
source $testdir/tester.tcl
|
sl@0
|
19 |
|
sl@0
|
20 |
ifcapable !compound||!view {
|
sl@0
|
21 |
finish_test
|
sl@0
|
22 |
return
|
sl@0
|
23 |
}
|
sl@0
|
24 |
|
sl@0
|
25 |
# The use of a VIEW that contained an ORDER BY clause within a UNION ALL
|
sl@0
|
26 |
# was causing problems. See ticket #1444.
|
sl@0
|
27 |
#
|
sl@0
|
28 |
do_test tkt1444-1.1 {
|
sl@0
|
29 |
execsql {
|
sl@0
|
30 |
CREATE TABLE DemoTable (x INTEGER, TextKey TEXT, DKey Real);
|
sl@0
|
31 |
CREATE INDEX DemoTableIdx ON DemoTable (TextKey);
|
sl@0
|
32 |
INSERT INTO DemoTable VALUES(9,8,7);
|
sl@0
|
33 |
INSERT INTO DemoTable VALUES(1,2,3);
|
sl@0
|
34 |
CREATE VIEW DemoView AS SELECT * FROM DemoTable ORDER BY TextKey;
|
sl@0
|
35 |
SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1;
|
sl@0
|
36 |
}
|
sl@0
|
37 |
} {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0}
|
sl@0
|
38 |
do_test tkt1444-1.2 {
|
sl@0
|
39 |
execsql {
|
sl@0
|
40 |
SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView;
|
sl@0
|
41 |
}
|
sl@0
|
42 |
} {9 8 7.0 1 2 3.0 1 2 3.0 9 8 7.0}
|
sl@0
|
43 |
do_test tkt1444-1.3 {
|
sl@0
|
44 |
execsql {
|
sl@0
|
45 |
DROP VIEW DemoView;
|
sl@0
|
46 |
CREATE VIEW DemoView AS SELECT * FROM DemoTable;
|
sl@0
|
47 |
SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1;
|
sl@0
|
48 |
}
|
sl@0
|
49 |
} {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0}
|
sl@0
|
50 |
do_test tkt1444-1.4 {
|
sl@0
|
51 |
execsql {
|
sl@0
|
52 |
SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView;
|
sl@0
|
53 |
}
|
sl@0
|
54 |
} {9 8 7.0 1 2 3.0 9 8 7.0 1 2 3.0}
|
sl@0
|
55 |
|
sl@0
|
56 |
finish_test
|