Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/test/windowD.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / test / windowD.test` 147 lines ยท 2844 bytes Raw Blame History 1 # 2022 June 2 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 set testdir [file dirname $argv0] 14 source $testdir/tester.tcl 15 set testprefix windowD 16 17 18 do_execsql_test 1.0 { 19 CREATE TABLE t0(c0 TEXT); 20 CREATE VIEW v0(c0, c1) 21 AS SELECT CUME_DIST() OVER (PARTITION BY t0.c0), TRUE FROM t0; 22 INSERT INTO t0 VALUES ('x'); 23 } 24 25 do_execsql_test 1.1 { 26 SELECT ('500') IS (v0.c1) FROM v0; 27 } { 28 0 29 } 30 31 do_execsql_test 1.2 { 32 SELECT (('500') IS (v0.c1)) FROM v0, t0; 33 } { 34 0 35 } 36 37 do_execsql_test 1.2 { 38 SELECT (('500') IS (v0.c1)) IS FALSE FROM v0; 39 } { 40 1 41 } 42 43 do_execsql_test 1.3 { 44 SELECT * FROM v0; 45 } { 46 1.0 1 47 } 48 49 do_execsql_test 1.4 { 50 SELECT * FROM v0 WHERE ('500' IS v0.c1) IS FALSE; 51 } { 52 1.0 1 53 } 54 55 #------------------------------------------------------------------------- 56 57 reset_db 58 do_execsql_test 2.0 { 59 CREATE TABLE t1(x); 60 INSERT INTO t1 VALUES('value'); 61 CREATE VIEW v1(a, b, c, d) AS SELECT 1, 2, TRUE, FALSE FROM t1; 62 } 63 64 do_execsql_test 2.1 { 65 SELECT 500 IS a, 500 IS b, 500 IS c, 500 IS d FROM v1 66 } {0 0 0 0} 67 68 do_execsql_test 2.2 { 69 SELECT * FROM v1 WHERE 500 IS c; 70 } {} 71 72 do_execsql_test 2.3 { 73 SELECT * FROM v1 WHERE 500 IS d; 74 } {} 75 76 do_execsql_test 2.4 { 77 CREATE VIEW v2 AS SELECT max(x) OVER () AS a, TRUE AS c FROM t1; 78 } 79 80 do_execsql_test 2.5 { 81 SELECT 500 IS c FROM v2; 82 } 0 83 84 do_execsql_test 2.6 { 85 SELECT * FROM v2 WHERE 500 IS c; 86 } {} 87 88 #------------------------------------------------------------------------- 89 # https://sqlite.org/bugs/info/2026-10-08T15:38:26Z 90 # 91 92 reset_db 93 do_execsql_test 3.0 { 94 CREATE TABLE t1(a); 95 CREATE TABLE t2(b); 96 CREATE TABLE t3(c); 97 INSERT INTO t1 VALUES (NULL); 98 INSERT INTO t2 VALUES (NULL); 99 INSERT INTO t3 VALUES (NULL); 100 } 101 102 do_execsql_test 3.1 { 103 SELECT 104 (SELECT count(*) FROM t1 LEFT JOIN t2 ON t3.c) 105 FROM t3; 106 } {1} 107 108 do_execsql_test 3.2 { 109 SELECT 110 count(*) OVER (), 111 (SELECT count(*) FROM t1 LEFT JOIN t2 ON t3.c) 112 FROM t3; 113 } {1 1} 114 115 do_execsql_test 3.3 { 116 SELECT count(*) FROM t1 LEFT JOIN t2 ON t1.a=t2.b 117 } {1} 118 119 do_execsql_test 3.4 { 120 SELECT count(*) OVER (), count(*) FROM t1 LEFT JOIN t2 ON t1.a=t2.b 121 } {1 1} 122 123 do_execsql_test 3.5 { 124 CREATE TABLE t4(d); 125 INSERT INTO t4 VALUES (NULL); 126 SELECT 127 count(*) OVER (), 128 (SELECT count(*) FROM t1 JOIN t2 ON t3.c RIGHT JOIN t4 ON 1) 129 FROM t3; 130 } {1 1} 131 132 do_execsql_test 3.6 { 133 SELECT 134 count(*) OVER (), 135 (SELECT count(*) FROM t1 RIGHT JOIN t2 ON t3.c) 136 FROM t3; 137 } {1 1} 138 139 do_execsql_test 3.7 { 140 SELECT 141 count(*) OVER (), 142 (SELECT count(*) FROM t1 FULL JOIN t2 ON t3.c) 143 FROM t3; 144 } {1 2} 145 146 finish_test 147