## 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 count_changes = NO;
PRAGMA trusted_schema = YES;
CREATE TABLE x(id integer primary key, a TEXT NULL);
INSERT INTO x (a) VALUES ('first');
CREATE TABLE tempx(id integer primary key, a TEXT NULL);
INSERT INTO tempx (a) VALUES ('t-first');
CREATE VIEW tv1 AS SELECT x.id, tx.id FROM x JOIN tempx tx ON tx.id=x.id;
CREATE VIEW tv1b AS SELECT x.id, tx.id FROM x JOIN tempx tx on tx.id=x.id;
CREATE VIEW tv2 AS SELECT * FROM tv1 UNION SELECT * FROM tv1b;
SELECT * FROM tv2;

SELECT * FROM tempx;
WITH cte(x) AS (VALUES(CAST(-'𝕊𝕢𝕝' AS NCHAR(9223372036854775806))),(2),(3)) SELECT * FROM cte WHERE NOT NOT (x > 1) ;
PRAGMA automatic_index = 1;
PRAGMA page_size = 4096;
INSERT INTO x VALUES (NULL, NULL);
SELECT RANK() OVER (ORDER BY id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM x;
CREATE  INDEX IF NOT EXISTS idx_tempx_9401 ON tempx(lower(id)) WHERE id > 0;
UPDATE x SET a = -32 WHERE a IS NOT NULL;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',3.14), (1,'b',-7.75), (2,'c',-9e999);
SELECT b,a,c,
RANK() OVER (PARTITION BY a ORDER BY c DESC) AS d FROM T;
ALTER TABLE T DROP COLUMN b;
PRAGMA cache_spill = 1;
```

## Actual output

```sql
1|1
1|t-first
2
3
1
2
a|1|3.14|1
b|1|-7.75|2
c|2|-Inf|1
```

## Expectation

```sql
1|1
1|t-first
0
2
3
1
2
a|1|3.14|1
b|1|-7.75|2
c|2|-Inf|1
```

## Flag

```
-bail
```

