3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
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.
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20 set ::testprefix tkt-8c63ff0ec
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);
28 INSERT INTO t3 VALUES(2),(2),(2),(2);
32 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=2
34 } {1 50 2 5 2 5 2 5 2 5 3 130}
36 SELECT a, b+c+d FROM t1
38 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=2
40 } {1 90 2 5 2 5 2 5 2 5 3 210}
42 SELECT a, b+c+d+e FROM t1
44 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=2
46 } {1 140 2 5 2 5 2 5 2 5 3 300}