## 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 vdbe_debug = YES;
ATTACH DATABASE ':memory:' AS aux63;
ATTACH DATABASE ':memory:' AS aux96;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(w INT, x INT);
INSERT INTO t1(w,x) VALUES(format(NULL, 6265634837190527139),10),(2,20),(3,30), (2,21),(3,31), (3,32);
CREATE INDEX t1wx ON t1(w,x);

DROP TABLE IF EXISTS t2;
CREATE TABLE t2(w INT, y VARCHAR(8));
INSERT INTO t2(w,y) VALUES(1,'one'),(2,'two'),(3,'three'),(4,'four');
CREATE INDEX t2wy ON t2(w,y);

WITH _m AS MATERIALIZED (SELECT * FROM t2) SELECT cnt, xyz, (SELECT y FROM _m WHERE w=cnt), '|' FROM (SELECT count(*) AS cnt, w AS xyz FROM t1 GROUP BY 2) ORDER BY cnt, xyz;
SELECT cnt, xyz, lower((SELECT y FROM t2 WHERE w=cnt)), '|' FROM (SELECT count(*) AS cnt, w AS xyz FROM t1 GROUP BY 2) ORDER BY cnt, xyz;
SELECT cnt, xyz, CASE WHEN (SELECT y FROM t2 WHERE w=cnt)=='two' THEN 'aaa' ELSE 'bbb' END, '|' FROM (SELECT count(*) AS cnt, w AS xyz FROM t1 GROUP BY 2) ORDER BY +cnt;

DETACH DATABASE aux96;

SELECT COUNT(*) FROM t1;
ALTER TABLE t2 ADD COLUMN extra_1857 MEDIUMINT DEFAULT NULL;
UPDATE t1 SET w = CURRENT_TIMESTAMP WHERE rowid = 1;
DETACH DATABASE aux63;
DELETE FROM t1 WHERE x > (SELECT AVG(x) FROM t1) RETURNING *;
SELECT STRING_AGG(x, '|') FROM t1;
REINDEX;
INSERT INTO t1 VALUES (NULL, NULL);
DROP TRIGGER IF EXISTS t2;
DROP TRIGGER IF EXISTS t1;
SELECT * FROM t2 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ANALYZE;
SELECT * FROM t2 WHERE EXISTS (SELECT 1 FROM t2 WHERE EXISTS (SELECT 1 FROM t2));
WITH cte AS (SELECT * FROM t1 WHERE x = (SELECT MAX(x) FROM t1)) SELECT * FROM cte;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t2_9622 ON t2(y) WHERE y IS NOT NULL;
```

## Actual output

```sql
1||one||
2|2|two||
3|3|three||
1||one||
2|2|two||
3|3|three||
1||bbb||
2|2|aaa||
3|3|bbb||
6
3|30
3|31
3|32
1|one||2026-05-15 11:38:36|10
2|two||2|20
3|three|||
4|four||2|21
1|one|
2|two|
3|three|
4|four|
2|21
```

## Expectation

```sql

```

## Flag

```

```

