## 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 legacy_alter_table = OFF;
PRAGMA legacy_alter_table = ON;
BEGIN IMMEDIATE;
CREATE TABLE main.t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES ((timediff(cosh((like('9223372036854775806%', instr(NULL, NULL)) + 0.0)), 1) - 0), '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 foreign_keys = NO;
CREATE TABLE main.t1(a);
INSERT INTO t1 VALUES(json_remove(replace(log(6.283185307179586), 'a', ''), '$.key', '$[0]'));
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;

ANALYZE t1;
SELECT LAG(a, 0, 'default') OVER (ORDER BY a) FROM t1;
DROP TRIGGER IF EXISTS t1;
SELECT SUM(a) FILTER (WHERE NOT NOT +a > 0) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT * FROM t1 AS a FULL OUTER JOIN t1 AS b ON a.rowid = b.rowid;
DELETE FROM t1 WHERE a IS NULL RETURNING *;

SELECT COUNT(*) FROM t1;
VACUUM;
UPDATE t1 SET a = a + 1 WHERE 1 RETURNING *;
CREATE /**/ INDEX IF NOT EXISTS idx_t1_5174 ON t1(a) WHERE a IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_2103 BEFORE UPDATE OF a ON t1 BEGIN SELECT RAISE(ABORT, 'abort'); END;
PRAGMA vdbe_listing = NO;
VACUUM;
ROLLBACK;
INSERT OR FAIL INTO t1 VALUES ('x');
CREATE TRIGGER IF NOT EXISTS trg_t1_1650 BEFORE DELETE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
CREATE VIRTUAL TABLE t0 USING fts4("x", "y", "z");
DROP TABLE t0;
BEGIN IMMEDIATE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES ((timediff(cosh(1), 1) - 0), '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 foreign_keys = NO;
CREATE TABLE main.t1(a);
INSERT INTO t1 VALUES(json_remove(replace(log(6.283185307179586), 'a', ''), '$.key', '$[0]'));
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;

ANALYZE t1;
SELECT LAG(a, 0, 'default') OVER (ORDER BY a) FROM t1;
DROP TRIGGER IF EXISTS t1;
SELECT SUM(a) FILTER (WHERE a > 0) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT * FROM t1 AS a FULL OUTER JOIN t1 AS b ON a.rowid = b.rowid;
DELETE FROM t1 WHERE a IS NULL RETURNING *;

SELECT COUNT(*) FROM t1;
VACUUM;
UPDATE t1 SET a = a + 1 WHERE 1 RETURNING *;
CREATE /**/ INDEX IF NOT EXISTS idx_t1_5174 ON t1(a) WHERE a IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_2103 BEFORE UPDATE OF a ON t1 BEGIN SELECT RAISE(ABORT, 'abort'); END;
PRAGMA vdbe_listing = NO;
VACUUM;
ROLLBACK;
INSERT OR FAIL INTO t1 VALUES ('x');
CREATE TRIGGER IF NOT EXISTS trg_t1_1650 BEFORE DELETE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
CREATE VIRTUAL TABLE t0 USING fts4("x", "y", "z");
DROP TABLE t0;
BEGIN IMMEDIATE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES ((timediff(cosh(1), 1) - 0), '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 foreign_keys = NO;
CREATE TABLE main.t1(a);
INSERT INTO t1 VALUES(json_remove(replace(log(6.283185307179586), 'a', ''), '$.key', '$[0]'));
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;

ANALYZE t1;
SELECT LAG(a, 0, 'default') OVER (ORDER BY a) FROM t1;
DROP TRIGGER IF EXISTS t1;
SELECT SUM(a) FILTER (WHERE a > 0) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT * FROM t1 AS a FULL OUTER JOIN t1 AS b ON a.rowid = b.rowid;
DELETE FROM t1 WHERE a IS NULL RETURNING *;

SELECT COUNT(*) FROM t1;
VACUUM;
UPDATE t1 SET a = a + 1 WHERE 1 RETURNING *;
CREATE /**/ INDEX IF NOT EXISTS idx_t1_5174 ON t1(a) WHERE a IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_2103 BEFORE UPDATE OF a ON t1 BEGIN SELECT RAISE(ABORT, 'abort'); END;
PRAGMA vdbe_listing = NO;
VACUUM;
ROLLBACK;
INSERT OR FAIL INTO t1 VALUES ('x');
CREATE TRIGGER IF NOT EXISTS trg_t1_1650 BEFORE DELETE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
CREATE VIRTUAL TABLE t0 USING fts4("x", "y", "z");
DROP TABLE t0;
BEGIN IMMEDIATE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES ((timediff(cosh(1), 1) - 0), '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 foreign_keys = NO;
CREATE TABLE main.t1(a);
INSERT INTO t1 VALUES(json_remove(replace(log(6.283185307179586), 'a', ''), '$.key', '$[0]'));
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;

ANALYZE t1;
SELECT LAG(a, 0, 'default') OVER (ORDER BY a) FROM t1;
DROP TRIGGER IF EXISTS t1;
SELECT SUM(a) FILTER (WHERE a > 0) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT * FROM t1 AS a FULL OUTER JOIN t1 AS b ON a.rowid = b.rowid;
DELETE FROM t1 WHERE a IS NULL RETURNING *;

SELECT COUNT(*) FROM t1;
VACUUM;
UPDATE t1 SET a = a + 1 WHERE 1 RETURNING *;
CREATE /**/ INDEX IF NOT EXISTS idx_t1_5174 ON t1(a) WHERE a IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_2103 BEFORE UPDATE OF a ON t1 BEGIN SELECT RAISE(ABORT, 'abort'); END;
PRAGMA vdbe_listing = NO;
VACUUM;
ROLLBACK;
INSERT OR FAIL INTO t1 VALUES ('x');
CREATE TRIGGER IF NOT EXISTS trg_t1_1650 BEFORE DELETE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
CREATE VIRTUAL TABLE t0 USING fts4("x", "y", "z");
DROP TABLE t0;
BEGIN IMMEDIATE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES ((timediff(cosh(1), 1) - 0), '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 foreign_keys = NO;
CREATE TABLE main.t1(a);
INSERT INTO t1 VALUES(json_remove(replace(log(6.283185307179586), 'a', ''), '$.key', '$[0]'));
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;

ANALYZE t1;
SELECT LAG(a, 0, 'default') OVER (ORDER BY a) FROM t1;
DROP TRIGGER IF EXISTS t1;
SELECT SUM(a) FILTER (WHERE a > 0) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
SELECT * FROM t1 AS a FULL OUTER JOIN t1 AS b ON a.rowid = b.rowid;
DELETE FROM t1 WHERE a IS NULL RETURNING *;

SELECT COUNT(*) FROM t1;
VACUUM;
UPDATE t1 SET a = a + 1 WHERE 1 RETURNING *;
CREATE /**/ INDEX IF NOT EXISTS idx_t1_5174 ON t1(a) WHERE a IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_2103 BEFORE UPDATE OF a ON t1 BEGIN SELECT RAISE(ABORT, 'abort'); END;
PRAGMA vdbe_listing = NO;
VACUUM;
ROLLBACK;
INSERT OR FAIL INTO t1 VALUES ('x');
CREATE TRIGGER IF NOT EXISTS trg_t1_1650 BEFORE DELETE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
CREATE VIRTUAL TABLE t0 USING fts4("x", "y", "z");
DROP TABLE t0;

WITH cte AS (SELECT a, LAG(a) OVER (ORDER BY a) AS prev FROM t1) SELECT * FROM cte;
INSERT INTO t1 VALUES ('x') ON CONFLICT(a) DO UPDATE SET a = excluded.a;
INSERT INTO t1 VALUES (NULL);

SELECT COUNT(*) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
DROP TRIGGER IF EXISTS t1;
INSERT INTO t1 DEFAULT VALUES;
SELECT * FROM t1 WHERE a IN (SELECT ALL a FROM t1);
SELECT SUM(a) FROM t1;
SELECT * FROM t1 t1 RIGHT JOIN t1 t2 ON t1.a = (SELECT a FROM t1 WHERE a = t1.a);
ANALYZE;
CREATE TABLE T1 (
  a INTEGER,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b TEXT
);
INSERT INTO T1 VALUES (1,'a'),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE T2.a=T1.a
) AS c
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;
PRAGMA page_count;
ALTER TABLE T2 ADD COLUMN extra_8536 INT8 DEFAULT CURRENT_TIMESTAMP;
SELECT * FROM T2;
SELECT NTH_VALUE(a, -1) OVER (ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA vdbe_debug = OFF;
INSERT INTO T2 VALUES (NULL, NULL);

SELECT COUNT(*) FILTER (WHERE b IS NOT NULL), SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T1;
SELECT AVG(b) FROM T2;
CREATE TEMP  VIEW IF NOT EXISTS v_T1_3200 AS SELECT a FROM T1;
VACUUM main;
DROP INDEX IF EXISTS t1;
```

## 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
von|20|2
Braun|30
von|20
```

## Expectation

```sql

```

## Flag

```

```

