OLD | NEW |
1 # 2013 April 17 | 1 # 2013 April 17 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #************************************************************************* | 10 #************************************************************************* |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 FROM t301 CROSS JOIN t302 | 59 FROM t301 CROSS JOIN t302 |
60 WHERE w=y AND y IS NOT NULL | 60 WHERE w=y AND y IS NOT NULL |
61 ORDER BY +w; | 61 ORDER BY +w; |
62 } {1 2 1 3 3 4 3 6 5 6 5 7} | 62 } {1 2 1 3 3 4 3 6 5 6 5 7} |
63 do_execsql_test transitive1-301 { | 63 do_execsql_test transitive1-301 { |
64 SELECT * | 64 SELECT * |
65 FROM t301 CROSS JOIN t302 | 65 FROM t301 CROSS JOIN t302 |
66 WHERE w=y AND y IS NOT NULL | 66 WHERE w=y AND y IS NOT NULL |
67 ORDER BY w; | 67 ORDER BY w; |
68 } {1 2 1 3 3 4 3 6 5 6 5 7} | 68 } {1 2 1 3 3 4 3 6 5 6 5 7} |
| 69 do_execsql_test transitive1-302 { |
| 70 SELECT * |
| 71 FROM t301 CROSS JOIN t302 |
| 72 WHERE w IS y AND y IS NOT NULL |
| 73 ORDER BY w; |
| 74 } {1 2 1 3 3 4 3 6 5 6 5 7} |
69 do_execsql_test transitive1-310 { | 75 do_execsql_test transitive1-310 { |
70 SELECT * | 76 SELECT * |
71 FROM t301 CROSS JOIN t302 ON w=y | 77 FROM t301 CROSS JOIN t302 ON w=y |
72 WHERE y>1 | 78 WHERE y>1 |
73 ORDER BY +w | 79 ORDER BY +w |
74 } {3 4 3 6 5 6 5 7} | 80 } {3 4 3 6 5 6 5 7} |
75 do_execsql_test transitive1-311 { | 81 do_execsql_test transitive1-311 { |
76 SELECT * | 82 SELECT * |
77 FROM t301 CROSS JOIN t302 ON w=y | 83 FROM t301 CROSS JOIN t302 ON w=y |
78 WHERE y>1 | 84 WHERE y>1 |
(...skipping 17 matching lines...) Expand all Loading... |
96 ORDER BY w; | 102 ORDER BY w; |
97 } {1 2 1 3 3 4 3 6} | 103 } {1 2 1 3 3 4 3 6} |
98 do_execsql_test transitive1-332 { | 104 do_execsql_test transitive1-332 { |
99 SELECT * | 105 SELECT * |
100 FROM t301 CROSS JOIN t302 ON w=y | 106 FROM t301 CROSS JOIN t302 ON w=y |
101 WHERE y BETWEEN 1 AND 4 | 107 WHERE y BETWEEN 1 AND 4 |
102 ORDER BY w DESC; | 108 ORDER BY w DESC; |
103 } {3 4 3 6 1 2 1 3} | 109 } {3 4 3 6 1 2 1 3} |
104 | 110 |
105 # Ticket [c620261b5b5dc] circa 2013-10-28. | 111 # Ticket [c620261b5b5dc] circa 2013-10-28. |
106 # Make sureconstraints are not used with LEFT JOINs. | 112 # Make sure constraints are not used with LEFT JOINs. |
107 # | 113 # |
108 # The next case is from the ticket report. It outputs no rows in 3.8.1 | 114 # The next case is from the ticket report. It outputs no rows in 3.8.1 |
109 # prior to the bug-fix. | 115 # prior to the bug-fix. |
110 # | 116 # |
111 do_execsql_test transitive1-400 { | 117 do_execsql_test transitive1-400 { |
112 CREATE TABLE t401(a); | 118 CREATE TABLE t401(a); |
113 CREATE TABLE t402(b); | 119 CREATE TABLE t402(b); |
114 CREATE TABLE t403(c INTEGER PRIMARY KEY); | 120 CREATE TABLE t403(c INTEGER PRIMARY KEY); |
115 INSERT INTO t401 VALUES(1); | 121 INSERT INTO t401 VALUES(1); |
116 INSERT INTO t403 VALUES(1); | 122 INSERT INTO t403 VALUES(1); |
117 SELECT '1-row' FROM t401 LEFT JOIN t402 ON b=a JOIN t403 ON c=a; | 123 SELECT '1-row' FROM t401 LEFT JOIN t402 ON b=a JOIN t403 ON c=a; |
118 } {1-row} | 124 } {1-row} |
| 125 do_execsql_test transitive1-401 { |
| 126 SELECT '1-row' FROM t401 LEFT JOIN t402 ON b IS a JOIN t403 ON c=a; |
| 127 } {1-row} |
| 128 do_execsql_test transitive1-402 { |
| 129 SELECT '1-row' FROM t401 LEFT JOIN t402 ON b=a JOIN t403 ON c IS a; |
| 130 } {1-row} |
| 131 do_execsql_test transitive1-403 { |
| 132 SELECT '1-row' FROM t401 LEFT JOIN t402 ON b IS a JOIN t403 ON c IS a; |
| 133 } {1-row} |
| 134 |
119 | 135 |
120 # The following is a script distilled from the XBMC project where the | 136 # The following is a script distilled from the XBMC project where the |
121 # bug was originally encountered. The correct answer is a single row | 137 # bug was originally encountered. The correct answer is a single row |
122 # of output. Before the bug was fixed, zero rows were generated. | 138 # of output. Before the bug was fixed, zero rows were generated. |
123 # | 139 # |
124 do_execsql_test transitive1-410 { | 140 do_execsql_test transitive1-410 { |
125 CREATE TABLE bookmark ( idBookmark integer primary key, idFile integer, timeIn
Seconds double, totalTimeInSeconds double, thumbNailImage text, player text, pla
yerState text, type integer); | 141 CREATE TABLE bookmark ( idBookmark integer primary key, idFile integer, timeIn
Seconds double, totalTimeInSeconds double, thumbNailImage text, player text, pla
yerState text, type integer); |
126 CREATE TABLE path ( idPath integer primary key, strPath text, strContent text,
strScraper text, strHash text, scanRecursive integer, useFolderNames bool, strS
ettings text, noUpdate bool, exclude bool, dateAdded text); | 142 CREATE TABLE path ( idPath integer primary key, strPath text, strContent text,
strScraper text, strHash text, scanRecursive integer, useFolderNames bool, strS
ettings text, noUpdate bool, exclude bool, dateAdded text); |
127 INSERT INTO "path" VALUES(1,'/tmp/tvshows/','tvshows','metadata.tvdb.com','989
B1CE5680A14F5F86123F751169B49',0,0,'<settings><setting id="absolutenumber" value
="false" /><setting id="dvdorder" value="false" /><setting id="fanart" value="tr
ue" /><setting id="language" value="en" /></settings>',0,0,NULL); | 143 INSERT INTO "path" VALUES(1,'/tmp/tvshows/','tvshows','metadata.tvdb.com','989
B1CE5680A14F5F86123F751169B49',0,0,'<settings><setting id="absolutenumber" value
="false" /><setting id="dvdorder" value="false" /><setting id="fanart" value="tr
ue" /><setting id="language" value="en" /></settings>',0,0,NULL); |
128 INSERT INTO "path" VALUES(2,'/tmp/tvshows/The.Big.Bang.Theory/','','','85E1DAA
B2F5FF6EAE8AEDF1B5C882D1E',NULL,NULL,NULL,NULL,NULL,'2013-10-23 18:58:43'); | 144 INSERT INTO "path" VALUES(2,'/tmp/tvshows/The.Big.Bang.Theory/','','','85E1DAA
B2F5FF6EAE8AEDF1B5C882D1E',NULL,NULL,NULL,NULL,NULL,'2013-10-23 18:58:43'); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 JOIN tvshowview ON tvshowview.idShow = episodeview.idShow | 289 JOIN tvshowview ON tvshowview.idShow = episodeview.idShow |
274 JOIN seasons ON (seasons.idShow = tvshowview.idShow | 290 JOIN seasons ON (seasons.idShow = tvshowview.idShow |
275 AND seasons.season = episodeview.c12) | 291 AND seasons.season = episodeview.c12) |
276 JOIN files ON files.idFile = episodeview.idFile | 292 JOIN files ON files.idFile = episodeview.idFile |
277 JOIN tvshowlinkpath ON tvshowlinkpath.idShow = tvshowview.idShow | 293 JOIN tvshowlinkpath ON tvshowlinkpath.idShow = tvshowview.idShow |
278 JOIN path ON path.idPath = tvshowlinkpath.idPath | 294 JOIN path ON path.idPath = tvshowlinkpath.idPath |
279 WHERE tvshowview.idShow = 1 | 295 WHERE tvshowview.idShow = 1 |
280 GROUP BY episodeview.c12; | 296 GROUP BY episodeview.c12; |
281 } {1 /tmp/tvshows/The.Big.Bang.Theory/ {The Big Bang Theory} {Leonard Hofstadter
and Sheldon Cooper are brilliant physicists, the kind of "beautiful minds" that
understand how the universe works. But none of that genius helps them interact
with people, especially women. All this begins to change when a free-spirited be
auty named Penny moves in next door. Sheldon, Leonard's roommate, is quite conte
nt spending his nights playing Klingon Boggle with their socially dysfunctional
friends, fellow CalTech scientists Howard Wolowitz and Raj Koothrappali. However
, Leonard sees in Penny a whole new universe of possibilities... including love.
} 2007-09-24 Comedy CBS TV-PG 3 1 0} | 297 } {1 /tmp/tvshows/The.Big.Bang.Theory/ {The Big Bang Theory} {Leonard Hofstadter
and Sheldon Cooper are brilliant physicists, the kind of "beautiful minds" that
understand how the universe works. But none of that genius helps them interact
with people, especially women. All this begins to change when a free-spirited be
auty named Penny moves in next door. Sheldon, Leonard's roommate, is quite conte
nt spending his nights playing Klingon Boggle with their socially dysfunctional
friends, fellow CalTech scientists Howard Wolowitz and Raj Koothrappali. However
, Leonard sees in Penny a whole new universe of possibilities... including love.
} 2007-09-24 Comedy CBS TV-PG 3 1 0} |
282 | 298 |
| 299 ############################################################################## |
| 300 # 2015-05-18. Make sure transitive constraints are avoided when column |
| 301 # affinities and collating sequences get in the way. |
| 302 # |
| 303 db close |
| 304 forcedelete test.db |
| 305 sqlite3 db test.db |
| 306 do_execsql_test transitive1-500 { |
| 307 CREATE TABLE x(i INTEGER PRIMARY KEY, y TEXT); |
| 308 INSERT INTO x VALUES(10, '10'); |
| 309 SELECT * FROM x WHERE x.y>='1' AND x.y<'2' AND x.i=x.y; |
| 310 } {10 10} |
| 311 do_execsql_test transitive1-510 { |
| 312 CREATE TABLE t1(x TEXT); |
| 313 CREATE TABLE t2(y TEXT); |
| 314 INSERT INTO t1 VALUES('abc'); |
| 315 INSERT INTO t2 VALUES('ABC'); |
| 316 SELECT * FROM t1 CROSS JOIN t2 WHERE (x=y COLLATE nocase) AND y='ABC'; |
| 317 } {abc ABC} |
| 318 do_execsql_test transitive1-520 { |
| 319 CREATE TABLE t3(i INTEGER PRIMARY KEY, t TEXT); |
| 320 INSERT INTO t3 VALUES(10, '10'); |
| 321 SELECT * FROM t3 WHERE i=t AND t = '10 '; |
| 322 } {} |
| 323 do_execsql_test transitive1-530 { |
| 324 CREATE TABLE u1(x TEXT, y INTEGER, z TEXT); |
| 325 CREATE INDEX i1 ON u1(x); |
| 326 INSERT INTO u1 VALUES('00013', 13, '013'); |
| 327 SELECT * FROM u1 WHERE x=y AND y=z AND z='013'; |
| 328 } {00013 13 013} |
| 329 do_execsql_test transitive1-540 { |
| 330 CREATE TABLE b1(x, y); |
| 331 INSERT INTO b1 VALUES('abc', 'ABC'); |
| 332 CREATE INDEX b1x ON b1(x); |
| 333 SELECT * FROM b1 WHERE (x=y COLLATE nocase) AND y='ABC'; |
| 334 } {abc ABC} |
| 335 do_execsql_test transitive1-550 { |
| 336 CREATE TABLE c1(x, y COLLATE nocase, z); |
| 337 INSERT INTO c1 VALUES('ABC', 'ABC', 'abc'); |
| 338 SELECT * FROM c1 WHERE x=y AND y=z AND z='abc'; |
| 339 } {ABC ABC abc} |
| 340 do_execsql_test transitive1-560 { |
| 341 CREATE INDEX c1x ON c1(x); |
| 342 SELECT * FROM c1 WHERE x=y AND y=z AND z='abc'; |
| 343 } {ABC ABC abc} |
| 344 do_execsql_test transitive1-560eqp { |
| 345 EXPLAIN QUERY PLAN |
| 346 SELECT * FROM c1 WHERE x=y AND y=z AND z='abc'; |
| 347 } {/SCAN TABLE c1/} |
| 348 do_execsql_test transitive1-570 { |
| 349 SELECT * FROM c1 WHERE x=y AND z=y AND z='abc'; |
| 350 } {} |
| 351 do_execsql_test transitive1-570eqp { |
| 352 EXPLAIN QUERY PLAN |
| 353 SELECT * FROM c1 WHERE x=y AND z=y AND z='abc'; |
| 354 } {/SEARCH TABLE c1 USING INDEX c1x/} |
283 | 355 |
284 finish_test | 356 finish_test |
OLD | NEW |