mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add support for using indexes for some ORDER BY clauses that use non-default NULL handling. Still some problems on this branch.
FossilOrigin-Name: 81069d7196857e909c94195d67388f71bc9f832eafd9156d8c5cdddb63513b4a
This commit is contained in:
@ -11,21 +11,19 @@
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
|
||||
####################################################
|
||||
# DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED!
|
||||
####################################################
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix nulls1
|
||||
|
||||
if 1 {
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t3(a INTEGER);
|
||||
INSERT INTO t3 VALUES(NULL), (10), (30), (20), (NULL);
|
||||
} {}
|
||||
|
||||
for {set a 0} {$a < 2} {incr a} {
|
||||
for {set a 0} {$a < 3} {incr a} {
|
||||
foreach {tn limit} {
|
||||
1 ""
|
||||
2 "LIMIT 10"
|
||||
@ -47,7 +45,43 @@ for {set a 0} {$a < 2} {incr a} {
|
||||
" {30 20 10 {} {}}
|
||||
}
|
||||
|
||||
catchsql { CREATE INDEX i1 ON t3(a) }
|
||||
switch $a {
|
||||
0 {
|
||||
execsql { CREATE INDEX i1 ON t3(a) }
|
||||
}
|
||||
1 {
|
||||
execsql { DROP INDEX i1 ; CREATE INDEX i1 ON t3(a DESC) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE TABLE t2(a, b, c);
|
||||
CREATE INDEX i2 ON t2(a, b);
|
||||
INSERT INTO t2 VALUES(1, 1, 1);
|
||||
INSERT INTO t2 VALUES(1, NULL, 2);
|
||||
INSERT INTO t2 VALUES(1, NULL, 3);
|
||||
INSERT INTO t2 VALUES(1, 4, 4);
|
||||
}
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
SELECT * FROM t2 WHERE a=1 ORDER BY b NULLS LAST
|
||||
} {
|
||||
1 1 1 1 4 4 1 {} 2 1 {} 3
|
||||
}
|
||||
|
||||
do_execsql_test 2.2 {
|
||||
SELECT * FROM t2 WHERE a=1 ORDER BY b DESC NULLS FIRST
|
||||
} {
|
||||
1 {} 3
|
||||
1 {} 2
|
||||
1 4 4
|
||||
1 1 1
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user