AryaWu/sqlite
0
1# 2014-02-252#3# The author disclaims copyright to this source code. In place of4# 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 same14# temporary register in concurrent co-routines, as been fixed.15# 16 17 18set testdir [file dirname $argv0]19source $testdir/tester.tcl20set ::testprefix tkt-8c63ff0ec21 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 t131 UNION ALL32 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=233 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 t137 UNION ALL38 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=239 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 t143 UNION ALL44 SELECT x, 5 FROM t2 JOIN t3 ON z=x WHERE x=245 ORDER BY a;46} {1 140 2 5 2 5 2 5 2 5 3 300}47 48finish_test49 