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 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing the WITH clause.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 source $testdir/malloc_common.tcl
18 set ::testprefix withM
26 CREATE TABLE t1(x INTEGER, y INTEGER);
27 INSERT INTO t1 VALUES(123, 456);
30 do_faultsim_test withM-1.1 -prep {
34 WITH tmp AS ( SELECT * FROM t1 )
38 faultsim_test_result {0 {123 456}}
42 do_faultsim_test withM-1.2 -prep {
46 WITH w1 AS ( SELECT * FROM t1 ),
48 WITH w3 AS ( SELECT * FROM w1 )
54 faultsim_test_result {0 {123 456}}
58 do_faultsim_test withM-1.3 -prep {
65 SELECT a+1, b + 2*a + 1 FROM w1
67 SELECT * FROM w1 LIMIT 5;
70 faultsim_test_result {0 {1 1 2 4 3 9 4 16 5 25}}