sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / test / tkt-4c86b126f2.test
| 1 | # 2014-02-11 |
| 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 | # This file implements regression tests for SQLite library. Specifically, |
| 12 | # it tests that ticket [4c86b126f22ad548fee0125337bdc9366912d9ac]. |
| 13 | # |
| 14 | # When SQLite is compiled using SQLITE_ENABLE_STAT3 or SQLITE_ENABLE_STAT4, |
| 15 | # it gets the wrong answer... |
| 16 | # |
| 17 | # The problem was introduced in SQLite 3.8.1. |
| 18 | |
| 19 | set testdir [file dirname $argv0] |
| 20 | source $testdir/tester.tcl |
| 21 | |
| 22 | do_execsql_test tkt-4c86b126f2-1.1 { |
| 23 | CREATE TABLE nodes( |
| 24 | local_relpath TEXT PRIMARY KEY, |
| 25 | moved_to TEXT |
| 26 | ); |
| 27 | INSERT INTO nodes VALUES('A',NULL); |
| 28 | INSERT INTO nodes VALUES('A/B',NULL); |
| 29 | INSERT INTO nodes VALUES('',NULL); |
| 30 | INSERT INTO nodes VALUES('A/B/C-move',NULL); |
| 31 | INSERT INTO nodes VALUES('A/B/C','A/B/C-move'); |
| 32 | INSERT INTO nodes VALUES('A/B-move',NULL); |
| 33 | INSERT INTO nodes VALUES('A/B-move/C-move',NULL); |
| 34 | INSERT INTO nodes VALUES('A/B-move/C','x'); |
| 35 | SELECT local_relpath, moved_to |
| 36 | FROM nodes |
| 37 | WHERE (local_relpath = 'A/B' OR |
| 38 | ((local_relpath > 'A/B/') AND (local_relpath < 'A/B0'))) |
| 39 | AND moved_to IS NOT NULL; |
| 40 | } {A/B/C A/B/C-move} |
| 41 | |
| 42 | do_execsql_test tkt-4c86b126f2-2.1 { |
| 43 | CREATE TABLE t1(x TEXT UNIQUE, y TEXT UNIQUE, z); |
| 44 | INSERT INTO t1 VALUES('ghi','jkl','y'); |
| 45 | SELECT * FROM t1 WHERE (x='ghi' OR y='jkl') AND z IS NOT NULL; |
| 46 | } {ghi jkl y} |
| 47 | |
| 48 | |
| 49 | finish_test |