mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Merge recent trunk micro-optimizations and the DESC index GROUP BY ORDER BY
bug fix into the sessions branch. FossilOrigin-Name: 83d4114f2aa404e670ced33511183baacd813a01
This commit is contained in:
@@ -202,6 +202,8 @@ do_test hook-4.1.2w {
|
||||
set ::update_hook {}
|
||||
execsql {
|
||||
INSERT INTO t1w VALUES(4, 'four');
|
||||
PRAGMA vdbe_debug=on;
|
||||
PRAGMA vdbe_addoptrace=on;
|
||||
DELETE FROM t1w WHERE b = 'two';
|
||||
UPDATE t1w SET b = '' WHERE a = 1 OR a = 3;
|
||||
DELETE FROM t1w WHERE 1; -- Avoid the truncate optimization (for now)
|
||||
|
||||
@@ -16,6 +16,9 @@ source $testdir/tester.tcl
|
||||
set ::testprefix index5
|
||||
|
||||
do_test 1.1 {
|
||||
if {[permutation]=="memsubsys1"} {
|
||||
execsql { PRAGMA auto_vacuum = 0; }
|
||||
}
|
||||
execsql {
|
||||
PRAGMA page_size = 1024;
|
||||
CREATE TABLE t1(x);
|
||||
@@ -38,7 +41,7 @@ tvfs filter xWrite
|
||||
tvfs script write_cb
|
||||
proc write_cb {xCall file handle iOfst args} {
|
||||
if {[file tail $file]=="test.db"} {
|
||||
lappend ::write_list [expr $iOfst/1024]
|
||||
lappend ::write_list [expr $iOfst/1024 + 1]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ optional) are:
|
||||
-makefile PATH-TO-MAKEFILE (default "releasetest.mk")
|
||||
-platform PLATFORM (see below)
|
||||
-quick BOOLEAN (default "0")
|
||||
-config CONFIGNAME (Run only CONFIGNAME)
|
||||
|
||||
The default value for -makefile is "./releasetest.mk".
|
||||
|
||||
@@ -292,6 +293,7 @@ proc run_test_suite {name testtarget config} {
|
||||
proc process_options {argv} {
|
||||
set ::MAKEFILE releasetest.mk ;# Default value
|
||||
set ::QUICK 0 ;# Default value
|
||||
set config {}
|
||||
set platform $::tcl_platform(os)-$::tcl_platform(machine)
|
||||
|
||||
for {set i 0} {$i < [llength $argv]} {incr i} {
|
||||
@@ -310,6 +312,11 @@ proc process_options {argv} {
|
||||
incr i
|
||||
set ::QUICK [lindex $argv $i]
|
||||
}
|
||||
|
||||
-config {
|
||||
incr i
|
||||
set config [lindex $argv $i]
|
||||
}
|
||||
|
||||
default {
|
||||
puts stderr ""
|
||||
@@ -333,7 +340,12 @@ proc process_options {argv} {
|
||||
exit
|
||||
}
|
||||
|
||||
set ::CONFIGLIST $::Platforms($platform)
|
||||
if {$config!=""} {
|
||||
if {[llength $config]==1} {lappend config fulltest}
|
||||
set ::CONFIGLIST $config
|
||||
} else {
|
||||
set ::CONFIGLIST $::Platforms($platform)
|
||||
}
|
||||
puts "Running the following configurations for $platform:"
|
||||
puts " [string trim $::CONFIGLIST]"
|
||||
}
|
||||
|
||||
@@ -934,6 +934,7 @@ void testset_cte(void){
|
||||
|
||||
}
|
||||
|
||||
#ifdef SQLITE_ENABLE_RTREE
|
||||
/* Generate two numbers between 1 and mx. The first number is less than
|
||||
** the second. Usually the numbers are near each other but can sometimes
|
||||
** be far apart.
|
||||
@@ -954,7 +955,9 @@ static void twoCoords(
|
||||
*pX0 = x0;
|
||||
*pX1 = x1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_ENABLE_RTREE
|
||||
/* The following routine is an R-Tree geometry callback. It returns
|
||||
** true if the object overlaps a slice on the Y coordinate between the
|
||||
** two values given as arguments. In other words
|
||||
@@ -974,7 +977,9 @@ static int xsliceGeometryCallback(
|
||||
*pRes = aCoord[3]>=p->aParam[0] && aCoord[2]<=p->aParam[1];
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif /* SQLITE_ENABLE_RTREE */
|
||||
|
||||
#ifdef SQLITE_ENABLE_RTREE
|
||||
/*
|
||||
** A testset for the R-Tree virtual table
|
||||
*/
|
||||
@@ -1110,6 +1115,7 @@ void testset_rtree(int p1, int p2){
|
||||
}
|
||||
speedtest1_end_test();
|
||||
}
|
||||
#endif /* SQLITE_ENABLE_RTREE */
|
||||
|
||||
/*
|
||||
** A testset used for debugging speedtest1 itself.
|
||||
@@ -1329,7 +1335,12 @@ int main(int argc, char **argv){
|
||||
}else if( strcmp(zTSet,"cte")==0 ){
|
||||
testset_cte();
|
||||
}else if( strcmp(zTSet,"rtree")==0 ){
|
||||
#ifdef SQLITE_ENABLE_RTREE
|
||||
testset_rtree(6, 147);
|
||||
#else
|
||||
fatal_error("compile with -DSQLITE_ENABLE_RTREE to enable "
|
||||
"the R-Tree tests\n");
|
||||
#endif
|
||||
}else{
|
||||
fatal_error("unknown testset: \"%s\"\nChoices: main debug1 cte rtree\n",
|
||||
zTSet);
|
||||
|
||||
65
test/tkt-ba7cbfaedc.test
Normal file
65
test/tkt-ba7cbfaedc.test
Normal file
@@ -0,0 +1,65 @@
|
||||
# 2014-10-11
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#*************************************************************************
|
||||
#
|
||||
# Test that ticket [ba7cbfaedc] has been fixed.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix tkt-ba7cbfaedc
|
||||
|
||||
do_execsql_test 1 {
|
||||
CREATE TABLE t1 (x, y);
|
||||
INSERT INTO t1 VALUES (3, 'a');
|
||||
INSERT INTO t1 VALUES (1, 'a');
|
||||
INSERT INTO t1 VALUES (2, 'b');
|
||||
INSERT INTO t1 VALUES (2, 'a');
|
||||
INSERT INTO t1 VALUES (3, 'b');
|
||||
INSERT INTO t1 VALUES (1, 'b');
|
||||
}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
CREATE INDEX i1 ON t1(x, y);
|
||||
}
|
||||
|
||||
foreach {n idx} {
|
||||
1 { CREATE INDEX i1 ON t1(x, y) }
|
||||
2 { CREATE INDEX i1 ON t1(x DESC, y) }
|
||||
3 { CREATE INDEX i1 ON t1(x, y DESC) }
|
||||
4 { CREATE INDEX i1 ON t1(x DESC, y DESC) }
|
||||
} {
|
||||
catchsql { DROP INDEX i1 }
|
||||
execsql $idx
|
||||
foreach {tn q res} {
|
||||
1 "GROUP BY x, y ORDER BY x, y" {1 a 1 b 2 a 2 b 3 a 3 b}
|
||||
2 "GROUP BY x, y ORDER BY x DESC, y" {3 a 3 b 2 a 2 b 1 a 1 b}
|
||||
3 "GROUP BY x, y ORDER BY x, y DESC" {1 b 1 a 2 b 2 a 3 b 3 a}
|
||||
4 "GROUP BY x, y ORDER BY x DESC, y DESC" {3 b 3 a 2 b 2 a 1 b 1 a}
|
||||
} {
|
||||
do_execsql_test 1.$n.$tn "SELECT * FROM t1 $q" $res
|
||||
}
|
||||
}
|
||||
|
||||
do_execsql_test 2.0 {
|
||||
drop table if exists t1;
|
||||
create table t1(id int);
|
||||
insert into t1(id) values(1),(2),(3),(4),(5);
|
||||
create index t1_idx_id on t1(id asc);
|
||||
select * from t1 group by id order by id;
|
||||
select * from t1 group by id order by id asc;
|
||||
select * from t1 group by id order by id desc;
|
||||
} {
|
||||
1 2 3 4 5 1 2 3 4 5 5 4 3 2 1
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user