xref: /sqlite-3.40.0/test/countofview.test (revision e89feee5)
1# 2018-08-04
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12#
13
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16source $testdir/malloc_common.tcl
17set testprefix countofview
18
19do_execsql_test 1.0 {
20  CREATE TABLE t2(c);
21  CREATE TABLE t3(f);
22
23  INSERT INTO t2 VALUES(1), (2);
24  INSERT INTO t3 VALUES(3);
25}
26
27do_execsql_test 1.1 {
28  select c from t2 union all select f from t3 limit 1 offset 1
29} {2}
30
31do_execsql_test 1.2 {
32  select count(*) from (
33    select c from t2 union all select f from t3 limit 1 offset 1
34  )
35} {1}
36
37do_execsql_test 1.3 {
38  select count(*) from (
39    select c from t2 union all select f from t3
40  )
41} {3}
42
43finish_test
44