## 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
ATTACH DATABASE ':memory:' AS aux93;
.read commands.sql
ATTACH DATABASE ':memory:' AS aux89;
BEGIN;
ATTACH DATABASE '' || (':memory:') AS aux30;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES ((unixepoch('<') + upper(123) -> '$.a' -> '$.b'), '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

WITH _m AS MATERIALIZED (SELECT * FROM t2) SELECT * FROM _m;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
.save output.db
PRAGMA cell_size_check = TRUE;
.timeout -log(('#' || ''), 9223372036854775809)
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (nullif(CAST(unixepoch(jsonb_replace(1, '$.key', 1)) AS REAL), 'same'),'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
CREATE TABLE t1(a INTEGER /* .schema !@#$%^&*()qwertyuiop[]\{}|asdfghjkl;':"zxcvbnm,./<>? */ PRIMARY KEY,R);
CREATE TABLE main.t2(x UNIQUE);
CREATE VIEW v1a(z,y) AS SELECT x IS NULL, x FROM t2;
SELECT a,(+a)b,(+a)b,(+a)b,NOT EXISTS(SELECT null FROM t2),CASE z WHEN max(json_type(487, '$.key'), 487) THEN 992 WHEN 391 THEN 203 WHEN 10 THEN '?k<D Q' END,'' FROM t1 LEFT JOIN v1a ON z=b;
PRAGMA short_column_names = 1;
SELECT LEAD(b) OVER (PARTITION BY b ORDER BY b ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UnioN ALL SELECT b, a+b, n+1 FROM fib WHERE +n<7) SELECT a, n FROM fib;
UPDATE T SET b = b + 1 WHERE b IS NOT NULL;
CREATE  INDEX IF NOT EXISTS idx_t1_565 ON t1(a COLLATE NOCASE) WHERE a IS NOT NULL;
DELETE FROM t1 WHERE 1;
INSERT INTO t2 VALUES (NULL) ON CONFLICT(x) DO UPDATE SET x = excluded.x;
UPDATE T SET c = NULL WHERE c BETWEEN 0 AND 100 RETURNING *;
CREATE  INDEX IF NOT EXISTS idx_T_9869 ON T(c COLLATE NOCASE);
SELECT * FROM t2;
SELECT COUNT(*) FROM t1;
INSERT INTO T SELECT * FROM T;
INSERT INTO t2 DEFAULT VALUES;
DELETE FROM t1 WHERE a IS NULL RETURNING /* PRAGMA query_only = 1; */ *;
CREATE TABLE T1 (
  A VARCHAR(20) PRIMARY KEY,
  X VARCHAR(10) UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(20) PRIMARY KEY,
  Y VARCHAR(10) UNIQUE
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
INSERT INTO T2 VALUES ('c', 'l');
SELECT A FROM T1 INTERSECT SELECT A FROM T2;
SELECT COUNT(x) OVER (ORDER BY x ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM t2;
SELECT * FROM t1 WHERE a = (SELECT COUNT(*) FROM t1);
ALTER TABLE T RENAME COLUMN c TO c_r3754;
REINDEX T;
SELECT GROUP_CONCAT(b) FROM T;
WITH cte AS (SELECT COUNT(*) AS cnt FROM t2) SELECT * FROM cte WHERE cnt > 0;
SELECT * FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t2 t2 WHERE t2.x = t2.x);
DELETE FROM t2 WHERE x IS NULL;
DROP INDEX IF /**/ EXISTS t1;
ALTER TABLE t2 RENAME TO t2_r4197;
ALTER TABLE T RENAME COLUMN d TO d_r7054;
ALTER TABLE T RENAME COLUMN d TO d_r437;
PRAGMA vdbe_debug = 0;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
PRAGMA fullsync = 1;
INSERT INTO t2 SELECT * FROM t2;
DETACH DATABASE aux30;
WITH cte AS (SELECT x, COUNT(*) AS cnt FROM t2 GROUP BY x) SELECT * FROM cte WHERE cnt > 1;
ROLLBACK;
SELECT LEAD(a, 2) OVER (ORDER BY a RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM T;
DROP VIEW IF EXISTS t1;
ALTER TABLE T ADD COLUMN extra_8461 DOUBLE;
WITH cte AS (SELECT a, LEAD(a) OVER (ORDER BY a) AS nxt FROM T) SELECT * FROM cte;
SELECT COUNT(*) FROM T;
PRAGMA incremental_vacuum(100);
SELECT * FROM t1;
ALTER TABLE t2 RENAME TO t2_r9528;
ALTER TABLE T RENAME COLUMN a TO a_r6338;
ALTER TABLE T ADD COLUMN extra_6788 REAL DEFAULT (random());
WITH RECURSIVE empty(x) AS (SELECT 1 WHERE 1=0 UNION ALL SELECT x+1 FROM empty WHERE x<10) SELECT * FROM empty;
DETACH DATABASE aux89;
SELECT AVG(b) 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 t1;
CREATE  INDEX IF NOT EXISTS idx_T_6367 ON T(lower(a)) WHERE a > 0;
ALTER TABLE T DROP COLUMN a;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_t2_6594 AS SELECT x FROM t2;
SELECT * FROM T2;
INSERT OR ABORT INTO T VALUES (0, 10);
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<39) SELECT SUM(x) FROM cnt;
DETACH DATABASE aux93;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T1 DEFAULT VALUES;
WITH cte AS (SELECT X FROM T1) SELECT * FROM cte;
```

## Actual output

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

## Expectation

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

## Flag

```
-table
```

