## 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
BEGIN EXCLUSIVE;
CREATE TABLE t1(a BIGINT PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (julianday(1), '' || ('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
CREATE TABLE T1 (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C INTEGER
);
CREATE TABLE T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE T2.A = T1.A AND T1.C >= 0;
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;


SELECT COUNT(*) FROM t1;
ANALYZE;
ALTER TABLE t1 ADD COLUMN extra_7819 REAL COLLATE RTRIM;
ALTER TABLE T RENAME COLUMN C TO C_r6771;
ANALYZE T2;
INSERT INTO T2 DEFAULT VALUES;
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;
ANALYZE;
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;
COMMIT TRANSACTION;
BEGIN EXCLUSIVE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, '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
CREATE TABLE T1 (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C INTEGER
);
CREATE TABLE T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE T2.A = T1.A AND T1.C >= 0;
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;


SELECT COUNT(*) FROM t1;
ANALYZE;
ALTER TABLE t1 ADD COLUMN extra_7819 REAL COLLATE RTRIM;
ALTER TABLE T RENAME COLUMN C TO C_r6771;
ANALYZE T2;
INSERT INTO T2 DEFAULT VALUES;
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;
ANALYZE;
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;
COMMIT TRANSACTION;
BEGIN EXCLUSIVE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, '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
CREATE TABLE T1 (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C INTEGER
);
CREATE TABLE T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE T2.A = T1.A AND T1.C >= 0;
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;


SELECT COUNT(*) FROM t1;
ANALYZE;
ALTER TABLE t1 ADD COLUMN extra_7819 REAL COLLATE RTRIM;
ALTER TABLE T RENAME COLUMN C TO C_r6771;
ANALYZE T2;
INSERT INTO T2 DEFAULT VALUES;
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;
ANALYZE;
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;
COMMIT TRANSACTION;
BEGIN EXCLUSIVE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, '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
CREATE TABLE T1 (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C INTEGER
);
CREATE TABLE T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE T2.A = T1.A AND T1.C >= 0;
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;


SELECT COUNT(*) FROM t1;
ANALYZE;
ALTER TABLE t1 ADD COLUMN extra_7819 REAL COLLATE RTRIM;
ALTER TABLE T RENAME COLUMN C TO C_r6771;
ANALYZE T2;
INSERT INTO T2 DEFAULT VALUES;
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;
ANALYZE;
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;
COMMIT TRANSACTION;
BEGIN EXCLUSIVE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, '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
CREATE TABLE T1 (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C INTEGER
);
CREATE TABLE T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE T2.A = T1.A AND T1.C >= 0;
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;


SELECT COUNT(*) FROM t1;
ANALYZE;
ALTER TABLE t1 ADD COLUMN extra_7819 REAL COLLATE RTRIM;
ALTER TABLE T RENAME COLUMN C TO C_r6771;
ANALYZE T2;
INSERT INTO T2 DEFAULT VALUES;
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;
ANALYZE;
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;
COMMIT TRANSACTION;
BEGIN EXCLUSIVE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, '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
CREATE TABLE T1 (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C INTEGER
);
CREATE TABLE T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE T2.A = T1.A AND T1.C >= 0;
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;
.width
BEGIN DEFERRED TRANSACTION;
ATTACH DATABASE ':memory:' AS aux50;
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES((round((mod(jsonb_array(), 0) * 1), -1) + 1),11);
INSERT INTO t1 VALUES(2,22);
INSERT INTO t1 SELECT a+2, b+22 FROM t1;
INSERT INTO t1 SELECT a+4, b+44 FROM t1;
CREATE TABLE t2(c,d);
INSERT INTO t2 /**/ SELECT a, 900+b FROM t1;
PRAGMA automatic_index=ON;
SELECT b, d FROM t1 JOIN t2 ON a=c ORDER BY b;

SELECT GROUP_CONCAT(c, '.') OVER (ORDER BY c ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t2;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
DETACH DATABASE aux50;
SELECT c, COUNT(*) FROM t2 GROUP BY c HAVING COUNT(*) = (SELECT COUNT(*) FROM t2);
ALTER TABLE t2 ADD COLUMN extra_7337 SMALLINT;
COMMIT;
VACUUM;
SELECT * FROM t1 AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
UPDATE T SET C = NULL;


SELECT COUNT(*) FROM t1;
ANALYZE;
ALTER TABLE t1 ADD COLUMN extra_7819 REAL COLLATE RTRIM;
ALTER TABLE T RENAME COLUMN C TO C_r6771;
ANALYZE T2;
INSERT INTO T2 DEFAULT VALUES;
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;
ANALYZE;
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;
COMMIT TRANSACTION;

SELECT * FROM t2;
INSERT INTO T2 DEFAULT VALUES;
```

## 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

```

```

