mirror of
https://github.com/sqlite/sqlite.git
synced 2024-11-29 00:12:23 +01:00
32 lines
1.0 KiB
Plaintext
32 lines
1.0 KiB
Plaintext
|
# 2023-10-18
|
||
|
#
|
||
|
# 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.
|
||
|
#
|
||
|
#***********************************************************************
|
||
|
# This file implements tests for ORDER BY on aggregate functions.
|
||
|
#
|
||
|
|
||
|
set testdir [file dirname $argv0]
|
||
|
source $testdir/tester.tcl
|
||
|
|
||
|
do_execsql_test aggorderby-1.1 {
|
||
|
CREATE TABLE t1(a,b,c,d);
|
||
|
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<20)
|
||
|
INSERT INTO t1(a,b,c,d) SELECT printf('x%d',x),1,x,200-x FROM c;
|
||
|
INSERT INTO t1(a,b,c,d) SELECT a, 2, c-3, -d FROM t1;
|
||
|
CREATE INDEX t1b ON t1(b);
|
||
|
}
|
||
|
do_catchsql_test aggorderby-1.2 {
|
||
|
SELECT b, group_concat(a ORDER BY max(d)) FROM t1 GROUP BY b;
|
||
|
} {1 {misuse of aggregate function max()}}
|
||
|
do_catchsql_test aggorderby-1.3 {
|
||
|
SELECT abs(a ORDER BY max(d)) FROM t1;
|
||
|
} {1 {ORDER BY may not be used with non-aggregate abs()}}
|
||
|
|
||
|
finish_test
|