## 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 IMMEDIATE;
.exit -CAST(json_valid(round(1, 2), 6) AS NCHAR(55))
SAVEPOINT sp603;
SAVEPOINT sp3675;
.timer on
.explain
.restore emplyeee.db
PRAGMA read_uncommitted == ON;
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (jsonb_object('' || ('k'), 1));
SELECT * FROM t0 GROUP BY c0;
CREATE TABLE `t1`(a, b);
CREATE TABLE t2(c, d);
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;
SELECT max(t1.a), (SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1) FROM t1;
SELECT MIN(c0) FROM t0;
ANALYZE;
SELECT MAX(d) FROM t2;
ROLLBACK TO sp3675;
RELEASE sp3675;
ALTER TABLE t1 DROP COLUMN b;
SELECT * FROM t1 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ROLLBACK TO sp603;
RELEASE sp603;
UPDATE t1 SET b = NULL WHERE b BETWEEN 0 OR 100;
REINDEX;
ALTER TABLE t1 ADD COLUMN extra_4020 DATETIME COLLATE RTRIM;
ALTER TABLE t2 ADD COLUMN extra_6540 TINYINT DEFAULT (abs(random()) % 1000);
ALTER TABLE t2 RENAME COLUMN c TO c_r4769;
DELETE FROM t0 WHERE 0 RETURNING *;
ALTER TABLE t0 DROP COLUMN c1;
.exit -CAST(1 AS NCHAR(55))
SAVEPOINT sp603;
SAVEPOINT sp3675;
.timer on
.explain
.restore emplyeee.db
PRAGMA read_uncommitted == ON;
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (jsonb_object('' || ('k'), 1));
SELECT * FROM t0 GROUP BY c0;
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
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;
SELECT max(t1.a), (SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1) FROM t1;
SELECT MIN(c0) FROM t0;
ANALYZE;
SELECT MAX(d) FROM t2;
ROLLBACK TO sp3675;
RELEASE sp3675;
ALTER TABLE t1 DROP COLUMN b;
SELECT * FROM t1 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ROLLBACK TO sp603;
RELEASE sp603;
UPDATE t1 SET b = NULL WHERE b BETWEEN 0 AND 100;
REINDEX;
ALTER TABLE t1 ADD COLUMN extra_4020 DATETIME COLLATE RTRIM;
ALTER TABLE t2 ADD COLUMN extra_6540 TINYINT DEFAULT (abs(random()) % 1000);
ALTER TABLE t2 RENAME COLUMN c TO c_r4769;
DELETE FROM t0 WHERE 0 RETURNING *;
ALTER TABLE t0 DROP COLUMN c1;
.exit -CAST(1 AS NCHAR(55))
SAVEPOINT sp603;
SAVEPOINT sp3675;
.timer on
.explain
.restore emplyeee.db
PRAGMA read_uncommitted == ON;
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (jsonb_object('' || ('k'), 1));
SELECT * FROM t0 GROUP BY c0;
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
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;
SELECT max(t1.a), (SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1) FROM t1;
SELECT MIN(c0) FROM t0;
ANALYZE;
SELECT MAX(d) FROM t2;
ROLLBACK TO sp3675;
RELEASE sp3675;
ALTER TABLE t1 DROP COLUMN b;
SELECT * FROM t1 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ROLLBACK TO sp603;
RELEASE sp603;
UPDATE t1 SET b = NULL WHERE b BETWEEN 0 AND 100;
REINDEX;
ALTER TABLE t1 ADD COLUMN extra_4020 DATETIME COLLATE RTRIM;
ALTER TABLE t2 ADD COLUMN extra_6540 TINYINT DEFAULT (abs(random()) % 1000);
ALTER TABLE t2 RENAME COLUMN c TO c_r4769;
DELETE FROM t0 WHERE 0 RETURNING *;
ALTER TABLE t0 DROP COLUMN c1;
.exit -CAST(1 AS NCHAR(55))
SAVEPOINT sp603;
SAVEPOINT sp3675;
.timer on
.explain
.restore emplyeee.db
PRAGMA read_uncommitted == ON;
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (jsonb_object('' || ('k'), 1));
SELECT * FROM t0 GROUP BY c0;
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
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;
SELECT max(t1.a), (SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1) FROM t1;
SELECT MIN(c0) FROM t0;
ANALYZE;
SELECT MAX(d) FROM t2;
ROLLBACK TO sp3675;
RELEASE sp3675;
ALTER TABLE t1 DROP COLUMN b;
SELECT * FROM t1 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ROLLBACK TO sp603;
RELEASE sp603;
UPDATE t1 SET b = NULL WHERE b BETWEEN 0 AND 100;
REINDEX;
ALTER TABLE t1 ADD COLUMN extra_4020 DATETIME COLLATE RTRIM;
ALTER TABLE t2 ADD COLUMN extra_6540 TINYINT DEFAULT (abs(random()) % 1000);
ALTER TABLE t2 RENAME COLUMN c TO c_r4769;
DELETE FROM t0 WHERE 0 RETURNING *;
ALTER TABLE t0 DROP COLUMN c1;
.exit -CAST(1 AS NCHAR(55))
SAVEPOINT sp603;
SAVEPOINT sp3675;
.timer on
.explain
.restore emplyeee.db
PRAGMA read_uncommitted == ON;
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (jsonb_object('' || ('k'), 1));
SELECT * FROM t0 GROUP BY c0;
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
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;
SELECT max(t1.a), (SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1) FROM t1;
SELECT MIN(c0) FROM t0;
ANALYZE;
SELECT MAX(d) FROM t2;
ROLLBACK TO sp3675;
RELEASE sp3675;
ALTER TABLE t1 DROP COLUMN b;
SELECT * FROM t1 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ROLLBACK TO sp603;
RELEASE sp603;
UPDATE t1 SET b = NULL WHERE b BETWEEN 0 AND 100;
REINDEX;
ALTER TABLE t1 ADD COLUMN extra_4020 DATETIME COLLATE RTRIM;
ALTER TABLE t2 ADD COLUMN extra_6540 TINYINT DEFAULT (abs(random()) % 1000);
ALTER TABLE t2 RENAME COLUMN c TO c_r4769;
DELETE FROM t0 WHERE 0 RETURNING *;
ALTER TABLE t0 DROP COLUMN c1;
.exit -CAST(1 AS NCHAR(55))
SAVEPOINT sp603;
SAVEPOINT sp3675;
.timer on
.explain
.restore emplyeee.db
PRAGMA read_uncommitted == ON;
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (jsonb_object('' || ('k'), 1));
SELECT * FROM t0 GROUP BY c0;
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
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;
SELECT max(t1.a), (SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1) FROM t1;
SELECT MIN(c0) FROM t0;
ANALYZE;
SELECT MAX(d) FROM t2;
ROLLBACK TO sp3675;
RELEASE sp3675;
ALTER TABLE t1 DROP COLUMN b;
SELECT * FROM t1 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ROLLBACK TO sp603;
RELEASE sp603;
UPDATE t1 SET b = NULL WHERE b BETWEEN 0 AND 100;
REINDEX;
ALTER TABLE t1 ADD COLUMN extra_4020 DATETIME COLLATE RTRIM;
ALTER TABLE t2 ADD COLUMN extra_6540 TINYINT DEFAULT (abs(random()) % 1000);
ALTER TABLE t2 RENAME COLUMN c TO c_r4769;
DELETE FROM t0 WHERE 0 RETURNING *;
ALTER TABLE t0 DROP COLUMN c1;
.exit -CAST(1 AS NCHAR(55))
SAVEPOINT sp603;
SAVEPOINT sp3675;
.timer on
.explain
.restore emplyeee.db
PRAGMA read_uncommitted == ON;
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (jsonb_object('' || ('k'), 1));
SELECT * FROM t0 GROUP BY c0;
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
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;
SELECT max(t1.a), (SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1) FROM t1;
SELECT MIN(c0) FROM t0;
ANALYZE;
SELECT MAX(d) FROM t2;
ROLLBACK TO sp3675;
RELEASE sp3675;
ALTER TABLE t1 DROP COLUMN b;
SELECT * FROM t1 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ROLLBACK TO sp603;
RELEASE sp603;
UPDATE t1 SET b = NULL WHERE b BETWEEN 0 AND 100;
REINDEX;
ALTER TABLE t1 ADD COLUMN extra_4020 DATETIME COLLATE RTRIM;
ALTER TABLE t2 ADD COLUMN extra_6540 TINYINT DEFAULT (abs(random()) % 1000);
ALTER TABLE t2 RENAME COLUMN c TO c_r4769;
DELETE FROM t0 WHERE 0 RETURNING *;
ALTER TABLE t0 DROP COLUMN c1;
.exit -CAST(1 AS NCHAR(55))
SAVEPOINT sp603;
SAVEPOINT sp3675;
.timer on
.explain
.restore emplyeee.db
PRAGMA read_uncommitted == ON;
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (jsonb_object('' || ('k'), 1));
SELECT * FROM t0 GROUP BY c0;
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
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;
SELECT max(t1.a), (SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1) FROM t1;
SELECT MIN(c0) FROM t0;
ANALYZE;
SELECT MAX(d) FROM t2;
ROLLBACK TO sp3675;
RELEASE sp3675;
ALTER TABLE t1 DROP COLUMN b;
SELECT * FROM t1 AS a LEFT OUTER JOIN t1 AS b ON a.rowid = b.rowid;
ROLLBACK TO sp603;
RELEASE sp603;
UPDATE t1 SET b = NULL WHERE b BETWEEN 0 AND 100;
REINDEX;
ALTER TABLE t1 ADD COLUMN extra_4020 DATETIME COLLATE RTRIM;
ALTER TABLE t2 ADD COLUMN extra_6540 TINYINT DEFAULT (abs(random()) % 1000);
ALTER TABLE t2 RENAME COLUMN c TO c_r4769;
DELETE FROM t0 WHERE 0 RETURNING *;
ALTER TABLE t0 DROP COLUMN c1;

DROP TABLE IF EXISTS T;
DELETE FROM t1 WHERE 1 RETURNING *;
SELECT * FROM T WHERE b = (SELECT b FROM T t2 WHERE t2.b = T.b LIMIT 1);
END TRANSACTION;
ALTER TABLE t0 RENAME COLUMN c1 TO c1_r4139;
WITH cte AS (SELECT * FROM t2) SELECT * FROM cte LEFT JOIN t2 ON cte.c = t2.c;
```

## Actual output

```sql
SQLite version 3.39.0 2022-05-10 23:28:12
Enter ".help" for usage hints.
sqlite> sqlite>
```

## Expectation

```sql
SQLite version 3.51.1 2025-11-28 17:28:25
Enter ".help" for usage hints.
sqlite> sqlite>
```

## Flag

```
-interactive
```

