1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Allow constant terms in the ORDER BY or GROUP BY clauses. Ticket #1768. (CVS 3173)

FossilOrigin-Name: d83e0230c0c4909cb035e266beffc0967526d9c1
This commit is contained in:
drh
2006-04-11 14:16:21 +00:00
parent a06ab2ca23
commit 18e87cff0a
5 changed files with 58 additions and 48 deletions

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the SELECT statement.
#
# $Id: select1.test,v 1.50 2006/03/26 01:21:23 drh Exp $
# $Id: select1.test,v 1.51 2006/04/11 14:16:22 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -282,36 +282,51 @@ do_test select1-4.4 {
set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1)}} msg]
lappend v $msg
} {1 {misuse of aggregate function min()}}
# The restriction not allowing constants in the ORDER BY clause
# has been removed. See ticket #1768
#do_test select1-4.5 {
# catchsql {
# SELECT f1 FROM test1 ORDER BY 8.4;
# }
#} {1 {ORDER BY terms must not be non-integer constants}}
#do_test select1-4.6 {
# catchsql {
# SELECT f1 FROM test1 ORDER BY '8.4';
# }
#} {1 {ORDER BY terms must not be non-integer constants}}
#do_test select1-4.7.1 {
# catchsql {
# SELECT f1 FROM test1 ORDER BY 'xyz';
# }
#} {1 {ORDER BY terms must not be non-integer constants}}
#do_test select1-4.7.2 {
# catchsql {
# SELECT f1 FROM test1 ORDER BY -8.4;
# }
#} {1 {ORDER BY terms must not be non-integer constants}}
#do_test select1-4.7.3 {
# catchsql {
# SELECT f1 FROM test1 ORDER BY +8.4;
# }
#} {1 {ORDER BY terms must not be non-integer constants}}
#do_test select1-4.7.4 {
# catchsql {
# SELECT f1 FROM test1 ORDER BY 4294967296; -- constant larger than 32 bits
# }
#} {1 {ORDER BY terms must not be non-integer constants}}
do_test select1-4.5 {
catchsql {
SELECT f1 FROM test1 ORDER BY 8.4;
execsql {
SELECT f1 FROM test1 ORDER BY 8.4
}
} {1 {ORDER BY terms must not be non-integer constants}}
} {11 33}
do_test select1-4.6 {
catchsql {
SELECT f1 FROM test1 ORDER BY '8.4';
execsql {
SELECT f1 FROM test1 ORDER BY '8.4'
}
} {1 {ORDER BY terms must not be non-integer constants}}
do_test select1-4.7.1 {
catchsql {
SELECT f1 FROM test1 ORDER BY 'xyz';
}
} {1 {ORDER BY terms must not be non-integer constants}}
do_test select1-4.7.2 {
catchsql {
SELECT f1 FROM test1 ORDER BY -8.4;
}
} {1 {ORDER BY terms must not be non-integer constants}}
do_test select1-4.7.3 {
catchsql {
SELECT f1 FROM test1 ORDER BY +8.4;
}
} {1 {ORDER BY terms must not be non-integer constants}}
do_test select1-4.7.4 {
catchsql {
SELECT f1 FROM test1 ORDER BY 4294967296; -- constant larger than 32 bits
}
} {1 {ORDER BY terms must not be non-integer constants}}
} {11 33}
do_test select1-4.8 {
execsql {
CREATE TABLE t5(a,b);