interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / tkt-8c63ff0ec.test

48 lines · 1387 bytes Raw Blame History
1# 2014-02-25
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# Test cases to show that ticket [8c63ff0eca81a9132d8d67b31cd6ae9712a2cc6f]
13# "Incorrect query result on a UNION ALL" which was caused by using the same
14# temporary register in concurrent co-routines, as been fixed.
15#
16
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20set ::testprefix tkt-8c63ff0ec
21
22do_execsql_test 1.1 {
23 CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, d, e);
24 INSERT INTO t1 VALUES(1,20,30,40,50),(3,60,70,80,90);
25 CREATE TABLE t2(x INTEGER PRIMARY KEY);
26 INSERT INTO t2 VALUES(2);
27 CREATE TABLE t3(z);
28 INSERT INTO t3 VALUES(2),(2),(2),(2);
29
30 SELECT a, b+c FROM t1
31 UNION ALL
32 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=2
33 ORDER BY a;
34} {1 50 2 5 2 5 2 5 2 5 3 130}
35do_execsql_test 1.2 {
36 SELECT a, b+c+d FROM t1
37 UNION ALL
38 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=2
39 ORDER BY a;
40} {1 90 2 5 2 5 2 5 2 5 3 210}
41do_execsql_test 1.3 {
42 SELECT a, b+c+d+e FROM t1
43 UNION ALL
44 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=2
45 ORDER BY a;
46} {1 140 2 5 2 5 2 5 2 5 3 300}
47
48finish_test