mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix the handling of sub-queries with LIMIT clauses by the optimization
activated by compile-time symbol SQLITE_COUNTOFVIEW_OPTIMIZATION. FossilOrigin-Name: 21235d9a41567897418aa12f7bd6dd8d6ee363147527e1d8fbca14fc83e0f2c9
This commit is contained in:
44
test/countofview.test
Normal file
44
test/countofview.test
Normal file
@ -0,0 +1,44 @@
|
||||
# 2018-08-04
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
set testprefix countofview
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t2(c);
|
||||
CREATE TABLE t3(f);
|
||||
|
||||
INSERT INTO t2 VALUES(1), (2);
|
||||
INSERT INTO t3 VALUES(3);
|
||||
}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
select c from t2 union all select f from t3 limit 1 offset 1
|
||||
} {2}
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
select count(*) from (
|
||||
select c from t2 union all select f from t3 limit 1 offset 1
|
||||
)
|
||||
} {1}
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
select count(*) from (
|
||||
select c from t2 union all select f from t3
|
||||
)
|
||||
} {3}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user