sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
| 1 | #!sqlite3 |
| 2 | # |
| 3 | # 2025-12-16 |
| 4 | # |
| 5 | # The author disclaims copyright to this source code. In place of |
| 6 | # a legal notice, here is a blessing: |
| 7 | # |
| 8 | # May you do good and not evil. |
| 9 | # May you find forgiveness for yourself and forgive others. |
| 10 | # May you share freely, never taking more than you give. |
| 11 | # |
| 12 | #*********************************************************************** |
| 13 | # |
| 14 | # Test cases for the .imposter command. |
| 15 | # |
| 16 | .open :memory: |
| 17 | .mode box -reset |
| 18 | .testcase 100 |
| 19 | CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT); |
| 20 | INSERT INTO t1 VALUES(1,'two',3),(4,'five',6); |
| 21 | CREATE INDEX t1bc ON t1(b,c); |
| 22 | .imposter T1BC x1 |
| 23 | ----------^^^^--- Different case that the original |
| 24 | SELECT * FROM x1; |
| 25 | .check <<END |
| 26 | CREATE TABLE "x1"("b","c","_ROWID_",PRIMARY KEY("b","c","_ROWID_"))WITHOUT ROWID; |
| 27 | ╭──────┬───┬─────────╮ |
| 28 | │ b │ c │ _ROWID_ │ |
| 29 | ╞══════╪═══╪═════════╡ |
| 30 | │ five │ 6 │ 4 │ |
| 31 | │ two │ 3 │ 1 │ |
| 32 | ╰──────┴───┴─────────╯ |
| 33 | END |