## Summary
<!--Explain briefly what goes wrong and explain why you believe this is a bug and not the intended behavior of SQLite (if it is not a crash).-->**No review yet**

## Minimized query

```sql
PRAGMA trusted_schema = ON;
.width -CAST(-(-(log(1))) AS DOUBLE) -2 -3
BEGIN DEFERRED TRANSACTION;
SAVEPOINT sp8626;
CREATE TABLE t1(a INT2 PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), '' || ('Wernher'), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE [T] (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT AND REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER /* TINYINT */ (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;

INSERT INTO T SELECT * FROM T;
ROLLBACK;
ANALYZE;
SELECT * FROM T2;
SELECT * FROM x1234 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(b) FROM T;
PRAGMA defer_foreign_keys;
SELECT LEAD(c, 2, 'default') OVER (PARTITION BY c ORDER BY c RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
SELECT * FROM T1 CROSS JOIN T2;
PRAGMA fullsync = TRUE;
INSERT OR REPLACE INTO T2 VALUES ('', 0);
INSERT INTO x1234 SELECT * FROM x1234;
ALTER TABLE t1 RENAME TO t1_r7666;
VACUUM;

SELECT COUNT(*) FROM T;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
INSERT INTO x1234 DEFAULT VALUES;
REINDEX x1234;
SELECT * FROM T AS a LEFT OUTER JOIN x1234 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 ADD COLUMN extra_2193 REAL DEFAULT '';
CREATE  INDEX IF NOT EXISTS idx_T1_7687 ON T1(X) WHERE X IS NOT NULL;
WITH cte AS (SELECT DISTINCT Y FROM T2) SELECT * FROM cte;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T2;
PRAGMA trusted_schema = ON;
.width -1 -2 -3
BEGIN DEFERRED TRANSACTION;
SAVEPOINT sp8626;
CREATE TABLE t1(a INT2 PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), '' || ('Wernher'), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE [T] (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT AND REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER /* TINYINT */ (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;

INSERT INTO T SELECT * FROM T;
ROLLBACK;
ANALYZE;
SELECT * FROM T2;
SELECT * FROM x1234 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(b) FROM T;
PRAGMA defer_foreign_keys;
SELECT LEAD(c, 2, 'default') OVER (PARTITION BY c ORDER BY c RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
SELECT * FROM T1 CROSS JOIN T2;
PRAGMA fullsync = TRUE;
INSERT OR REPLACE INTO T2 VALUES ('', 0);
INSERT INTO x1234 SELECT * FROM x1234;
ALTER TABLE t1 RENAME TO t1_r7666;
VACUUM;

SELECT COUNT(*) FROM T;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
INSERT INTO x1234 DEFAULT VALUES;
REINDEX x1234;
SELECT * FROM T AS a LEFT OUTER JOIN x1234 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 ADD COLUMN extra_2193 REAL DEFAULT '';
CREATE  INDEX IF NOT EXISTS idx_T1_7687 ON T1(X) WHERE X IS NOT NULL;
WITH cte AS (SELECT DISTINCT Y FROM T2) SELECT * FROM cte;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T2;
PRAGMA trusted_schema = ON;
.width -1 -2 -3
BEGIN DEFERRED TRANSACTION;
SAVEPOINT sp8626;
CREATE TABLE t1(a INT2 PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), '' || ('Wernher'), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE [T] (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT AND REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER /* TINYINT */ (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T /* min({v}) */ (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;

INSERT INTO T SELECT * FROM T;
ROLLBACK;
ANALYZE;
SELECT * FROM T2;
SELECT * FROM x1234 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(b) FROM T;
PRAGMA defer_foreign_keys;
SELECT LEAD(c, 2, 'default') OVER (PARTITION BY c ORDER BY c RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
SELECT * FROM T1 CROSS JOIN T2;
PRAGMA fullsync = TRUE;
INSERT OR REPLACE INTO T2 VALUES ('', 0);
INSERT INTO x1234 SELECT * FROM x1234;
ALTER TABLE t1 RENAME TO t1_r7666;
VACUUM;

SELECT COUNT(*) FROM T;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
INSERT INTO x1234 DEFAULT VALUES;
REINDEX x1234;
SELECT * FROM T AS a LEFT OUTER JOIN x1234 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 ADD COLUMN extra_2193 REAL DEFAULT '';
CREATE  INDEX IF NOT EXISTS idx_T1_7687 ON T1(X) WHERE X IS NOT NULL;
WITH cte AS (SELECT DISTINCT Y FROM T2) SELECT * FROM cte;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T2;
PRAGMA trusted_schema = ON;
.width -1 -2 -3
BEGIN DEFERRED TRANSACTION;
SAVEPOINT sp8626;
CREATE TABLE t1(a INT2 PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), '' || ('Wernher'), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE [T] (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT AND REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER /* TINYINT */ (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;

INSERT INTO T SELECT * FROM T;
ROLLBACK;
ANALYZE;
SELECT * FROM T2;
SELECT * FROM x1234 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(b) FROM T;
PRAGMA defer_foreign_keys;
SELECT LEAD(c, 2, 'default') OVER (PARTITION BY c ORDER BY c RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
SELECT * FROM T1 CROSS JOIN T2;
PRAGMA fullsync = TRUE;
INSERT OR REPLACE INTO T2 VALUES ('', 0);
INSERT INTO x1234 SELECT * FROM x1234;
ALTER TABLE t1 RENAME TO t1_r7666;
VACUUM;

SELECT COUNT(*) FROM T;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
INSERT INTO x1234 DEFAULT VALUES;
REINDEX x1234;
SELECT * FROM T AS a LEFT OUTER JOIN x1234 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 ADD COLUMN extra_2193 REAL DEFAULT '';
CREATE  INDEX IF NOT EXISTS idx_T1_7687 ON T1(X) WHERE X IS NOT NULL;
WITH cte AS (SELECT DISTINCT Y FROM T2) SELECT * FROM cte;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T2;
PRAGMA trusted_schema = ON;
.width -1 -2 -3
BEGIN DEFERRED TRANSACTION;
SAVEPOINT sp8626;
CREATE TABLE t1(a INT2 PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), '' || ('Wernher'), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE [T] (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT AND REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER /* TINYINT */ (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;

INSERT INTO T SELECT * FROM T;
ROLLBACK;
ANALYZE;
SELECT * FROM T2;
SELECT * FROM x1234 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(b) FROM T;
PRAGMA defer_foreign_keys;
SELECT LEAD(c, 2, 'default') OVER (PARTITION BY c ORDER BY c RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
SELECT * FROM T1 CROSS JOIN T2;
PRAGMA fullsync = TRUE;
INSERT OR REPLACE INTO T2 VALUES ('', 0);
INSERT INTO x1234 SELECT * FROM x1234;
ALTER TABLE t1 RENAME TO t1_r7666;
VACUUM;

SELECT COUNT(*) FROM T;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
INSERT INTO x1234 DEFAULT VALUES;
REINDEX x1234;
SELECT * FROM T AS a LEFT OUTER JOIN x1234 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 ADD COLUMN extra_2193 REAL DEFAULT '';
CREATE  INDEX IF NOT EXISTS idx_T1_7687 ON T1(X) WHERE X IS NOT NULL;
WITH cte AS (SELECT DISTINCT Y FROM T2) SELECT * FROM cte;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T2;
PRAGMA trusted_schema = ON;
.width -1 -2 -3
BEGIN DEFERRED TRANSACTION;
SAVEPOINT sp8626;
CREATE TABLE t1(a INT2 PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), '' || ('Wernher'), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE [T] (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT AND REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER /* TINYINT */ (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;

INSERT INTO T SELECT * FROM T;
ROLLBACK;
ANALYZE;
SELECT * FROM T2;
SELECT * FROM x1234 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(b) FROM T;
PRAGMA defer_foreign_keys;
SELECT LEAD(c, 2, 'default') OVER (PARTITION BY c ORDER BY c RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
SELECT * FROM T1 CROSS JOIN T2;
PRAGMA fullsync = TRUE;
INSERT OR REPLACE INTO T2 VALUES ('', 0);
INSERT INTO x1234 SELECT * FROM x1234;
ALTER TABLE t1 RENAME TO t1_r7666;
VACUUM;

SELECT COUNT(*) FROM T;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
INSERT INTO x1234 DEFAULT VALUES;
REINDEX x1234;
SELECT * FROM T AS a LEFT OUTER JOIN x1234 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 ADD COLUMN extra_2193 REAL DEFAULT '';
CREATE  INDEX IF NOT EXISTS idx_T1_7687 ON T1(X) WHERE X IS NOT NULL;
WITH cte AS (SELECT DISTINCT Y FROM T2) SELECT * FROM cte;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T2;
PRAGMA trusted_schema = ON;
.width -1 -2 -3
BEGIN DEFERRED TRANSACTION;
SAVEPOINT sp8626;
CREATE TABLE t1(a INT2 PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), '' || ('Wernher'), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE [T] (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT AND REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER /* TINYINT */ (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;

INSERT INTO T SELECT * FROM T;
ROLLBACK;
ANALYZE;
SELECT * FROM T2;
SELECT * FROM x1234 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(b) FROM T;
PRAGMA defer_foreign_keys;
SELECT LEAD(c, 2, 'default') OVER (PARTITION BY c ORDER BY c RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
SELECT * FROM T1 CROSS JOIN T2;
PRAGMA fullsync = TRUE;
INSERT OR REPLACE INTO T2 VALUES ('', 0);
INSERT INTO x1234 SELECT * FROM x1234;
ALTER TABLE t1 RENAME TO t1_r7666;
VACUUM;

SELECT COUNT(*) FROM T;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
INSERT INTO x1234 DEFAULT VALUES;
REINDEX x1234;
SELECT * FROM T AS a LEFT OUTER JOIN x1234 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 ADD COLUMN extra_2193 REAL DEFAULT '';
CREATE  INDEX IF NOT EXISTS idx_T1_7687 ON T1(X) WHERE X IS NOT NULL;
WITH cte AS (SELECT DISTINCT Y FROM T2) SELECT * FROM cte;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T2;
PRAGMA trusted_schema = ON;
.width -1 -2 -3
BEGIN DEFERRED TRANSACTION;
SAVEPOINT sp8626;
CREATE TABLE t1(a INT2 PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), '' || ('Wernher'), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE [T] (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT AND REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER /* TINYINT */ (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;
SAVEPOINT sp8626;
CREATE TABLE t1(a SMALLINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (exp(-(-(2147483648))), 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
PRAGMA module_list;
PRAGMA automatic_index;
CREATE TABLE t1(c, b, a, PRIMARY KEY(b, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(--10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2, 3), (4, 5, 6);
ALTER TABLE t1 DROP c;
CREATE TABLE x1234(a, b, c PRIMARY KEY) WITHOUT ROWID;
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM T GROUP BY B ORDER BY D DESC, B ASC;
CREATE INDEX i1 ON x1234(b) WHERE ((a+5) % 10)=0;
ANALYZE x1234;
CREATE TRIGGER IF NOT EXISTS trg_t1_8594 AFTER INSERT ON t1 BEGIN SELECT RAISE(IGNORE); END;
INSERT INTO x1234 VALUES (NULL, NULL, NULL);
DELETE FROM t1 WHERE rowid = 39;
INSERT INTO t1 VALUES ('x', 1, 1) ON CONFLICT(c) DO UPDATE SET c = excluded.c, b = excluded.b, a = excluded.a;
ALTER TABLE t1 RENAME COLUMN c TO c_r2993;
INSERT OR REPLACE INTO t1 VALUES (NULL, NULL, '');
ALTER TABLE T RENAME TO T_r3030;

ALTER TABLE T DROP COLUMN A;
CREATE TRIGGER IF NOT EXISTS trg_t1_9080 BEFORE UPDATE OF a ON t1 FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE A IN (SELECT x FROM cte);
SELECT * FROM t1 LEFT OUTER JOIN x1234;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT * FROM t1 t1 JOIN (SELECT * FROM t1) AS sub ON t1.a = sub.a;
ANALYZE T1;
INSERT INTO T SELECT * FROM T;
ROLLBACK TRANSACTION TO SAVEPOINT sp8626;
RELEASE SAVEPOINT sp8626;
SELECT RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
DELETE FROM T WHERE b IS NULL RETURNING *;
DROP TRIGGER IF EXISTS x1234;

INSERT INTO T SELECT * FROM T;
ROLLBACK;
ANALYZE;
SELECT * FROM T2;
SELECT * FROM x1234 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(b) FROM T;
PRAGMA defer_foreign_keys;
SELECT LEAD(c, 2, 'default') OVER (PARTITION BY c ORDER BY c RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
SELECT * FROM T1 CROSS JOIN T2;
PRAGMA fullsync = TRUE;
INSERT OR REPLACE INTO T2 VALUES ('', 0);
INSERT INTO x1234 SELECT * FROM x1234;
ALTER TABLE t1 RENAME TO t1_r7666;
VACUUM;

SELECT COUNT(*) FROM T;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
INSERT INTO x1234 DEFAULT VALUES;
REINDEX x1234;
SELECT * FROM T AS a LEFT OUTER JOIN x1234 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 ADD COLUMN extra_2193 REAL DEFAULT '';
CREATE  INDEX IF NOT EXISTS idx_T1_7687 ON T1(X) WHERE X IS NOT NULL;
WITH cte AS (SELECT DISTINCT Y FROM T2) SELECT * FROM cte;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T2;

SELECT COUNT(*) FILTER (WHERE Y IS NOT NULL), SUM(rowid) FILTER (WHERE Y > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(Y) FILTER (WHERE Y > 0 AND Y < 100), COUNT(*) FILTER (WHERE typeof(Y) = "text") FROM T2;
DELETE FROM T2 WHERE 0;
SELECT SUM(X) FROM T1;
CREATE  INDEX IF NOT EXISTS idx_T1_3420 ON T1(A COLLATE NOCASE);
ALTER TABLE T1 DROP COLUMN A;
```

## Actual output

```sql
CREATE TABLE "t2"("b","c","_ROWID_",PRIMARY KEY("b","c","_ROWID_"))WITHOUT ROWID;
WARNING: writing to an imposter table will corrupt the "t1bc" index!
Braun|30|3
Wernher|10|1
von|20|2
Braun|30
Wernher|10
von|20
```

## Expectation

```sql
CREATE TABLE "t2"("b","c","_ROWID_",PRIMARY KEY("b","c","_ROWID_"))WITHOUT ROWID;
Braun|30|3
Wernher|10|1
von|20|2
Braun|30
Wernher|10
von|20
```

## Flag

```
-init employee.db
```

