mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add the SQLITE_MAX_COMPOUND_SELECT compile-time parameter for limiting
the number of terms in a compound select statement. Set the default limit to 100. (CVS 4046) FossilOrigin-Name: 0d71ad4591eae9de8749fb2da6455ac661587f7a
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
# focus of this file is testing compute SELECT statements and nested
|
||||
# views.
|
||||
#
|
||||
# $Id: select7.test,v 1.9 2007/05/09 22:56:39 drh Exp $
|
||||
# $Id: select7.test,v 1.10 2007/06/07 10:55:36 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -135,4 +135,23 @@ ifcapable {subquery && compound} {
|
||||
{only a single result allowed for a SELECT that is part of an expression}]
|
||||
}
|
||||
|
||||
# Verify that an error occurs if you have too many terms on a
|
||||
# compound select statement.
|
||||
#
|
||||
if {$SQLITE_MAX_COMPOUND_SELECT>0} {
|
||||
set sql {SELECT 0}
|
||||
set result 0
|
||||
for {set i 1} {$i<$SQLITE_MAX_COMPOUND_SELECT} {incr i} {
|
||||
append sql " UNION ALL SELECT $i"
|
||||
lappend result $i
|
||||
}
|
||||
do_test select7-6.1 {
|
||||
catchsql $sql
|
||||
} [list 0 $result]
|
||||
append sql { UNION ALL SELECT 99999999}
|
||||
do_test select7-6.2 {
|
||||
catchsql $sql
|
||||
} {1 {too many terms in compound SELECT}}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user