## 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;
PRAGMA fullsync = 0;
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;
DELETE FROM T WHERE B IS NULL RETURNING *;
COMMIT;
SELECT * FROM T AS a INNER JOIN T AS b ON a.rowid = b.rowid;
ALTER TABLE T RENAME TO T_r3892;
DROP TABLE IF EXISTS T;
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 UNIQUE  INDEX IF NOT EXISTS idx_T_9501 ON T(A) WHERE A IS NOT NULL;
```

## Actual output

```sql
q|2

r|2

p|1

t|1

a|p|a|p

a|q|a|q

b|q|b|q

c|r|c|r

b|r|b|r

b|t|b|t

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
q|2

r|2

p|1

t|1

a|p|a|p

a|q|a|q

b|q|b|q

c|r|c|r

b|r|b|r

b|t|b|t

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

```
-newline "

"
```

