## 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 recursive_triggers = ON;
PRAGMA defer_foreign_keys = OFF;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull(('{' || ''), 'fallback'))) * (2.718281828459045 * 1)), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE NOT b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull('{', 'fallback'))) * 1), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull('{', 'fallback'))) * 1), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull('{', 'fallback'))) * 1), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull('{', 'fallback'))) * 1), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull('{', 'fallback'))) * 1), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull('{', 'fallback'))) * 1), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull('{', 'fallback'))) * 1), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;
.stats
CREATE TABLE main.t1(a, b TEXT);
CREATE UNIQUE INDEX IF NOT EXISTS x1 ON t1(b==log((-(-(-ifnull('{', 'fallback'))) * 1), 0));
CREATE INDEX IF NOT EXISTS x2 ON t1(a || 0) WHERE b;
INSERT INTO t1(a,b) VALUES('a',1),('a',0);
SELECT a, b, '|' FROM t1;

DROP INDEX IF EXISTS t1;
WITH m AS MATERIALIZED (SELECT a FROM t1) SELECT * FROM m;
UPDATE t1 SET a = CURRENT_TIMESTAMP WHERE a BETWEEN 0 AND 100 RETURNING *;
SELECT LAG(a, 0) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT MAX(a) FROM t1;
SELECT * FROM t1;
VACUUM main;
SELECT * FROM t1 WHERE b IN (SELECT b FROM t1 LIMIT 0);
ALTER TABLE t1 RENAME TO t1_r2082;
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
VACUUM main;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 ADD COLUMN extra_4108 BIGINT;
DELETE FROM t1 WHERE rowid = 7;

INSERT INTO t1 SELECT * FROM t1;
ALTER TABLE t1 ADD COLUMN extra_4216 NONE DEFAULT 0;
VACUUM;
UPDATE t1 SET c = '' WHERE 1;

DELETE FROM t1 WHERE 0;
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;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_2095 AS SELECT b FROM T;
ALTER TABLE t1 DROP COLUMN a;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_458 AS SELECT c FROM T;
DROP VIEW IF EXISTS t1;
ALTER TABLE t1 DROP COLUMN a;
CREATE TEMP  VIEW IF NOT EXISTS v_t1_5034 AS SELECT b FROM t1;
VACUUM;
```

## Actual output

```sql
Memory Used:                         62592 (max 62592) bytes
Number of Outstanding Allocations:   122 (max 122)
Number of Pcache Overflow Bytes:     4104 (max 4104) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4104 bytes
Lookaside Slots Used:                32 (max 36)
Successful lookaside attempts:       42
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    4904 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Schema Heap Usage:                   0 bytes
Statement Heap/Lookaside Usage:      0 bytes
Bytes received by read():            10409
Bytes sent to write():               0
Read() system calls:                 13
Write() system calls:                0
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
a|1||
a|0||
a
a
a
a
a
a|1
a|0
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
Memory Used:                         63416 (max 63416) bytes
Number of Outstanding Allocations:   132 (max 132)
Number of Pcache Overflow Bytes:     4104 (max 4104) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4104 bytes
Lookaside Slots Used:                48 (max 52)
Successful lookaside attempts:       58
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    4904 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Temporary data spilled to disk:      0
Schema Heap Usage:                   0 bytes
Statement Heap/Lookaside Usage:      0 bytes
Bytes received by read():            11185
Bytes sent to write():               0
Read() system calls:                 14
Write() system calls:                0
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
a|1||
a|0||
a
a
a
a
a
a|1
a|0
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

```

```

