## 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 EXCLUSIVE;
BEGIN DEFERRED;
SAVEPOINT sp873;
BEGIN TRANSACTION;
PRAGMA quick_check(CAST(CAST(time(json_array()) AS REAL) AS INTEGER));
.exit
SAVEPOINT sp9184;
SAVEPOINT sp1810;
CREATE TABLE T1 (
  a FLOAT,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b /**/ TEXT
);
INSERT INTO T1 VALUES (1,'' || ('a')),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE NOT T2.a=T1.a
) AS c
FROM /* PRAGMA pragma_list; */ T1;
SELECT * FROM T2 AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL),  SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T1;
ROLLBACK TRANSACTION TO SAVEPOINT sp1810;
RELEASE SAVEPOINT sp1810;
INSERT OR IGNORE INTO T2 VALUES (0, 3);
ALTER TABLE T1 ADD COLUMN extra_3426 ANY DEFAULT 0;
INSERT INTO T2 DEFAULT VALUES;
ROLLBACK TO sp9184;
RELEASE sp9184;
DROP INDEX IF EXISTS T1;
ANALYZE;
COMMIT TRANSACTION;
ALTER TABLE T1 RENAME COLUMN b TO b_r7501;
SELECT MIN(a) FROM T2;
SELECT b FROM T1 EXCEPT SELECT b FROM (SELECT * FROM T1) AS sub;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL RETURNING *;
PRAGMA locking_mode;
CREATE  INDEX IF NOT EXISTS idx_T1_2051 ON T1(b COLLATE NOCASE);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_8990 ON T1(lower(a));
WITH n AS NOT MATERIALIZED (SELECT * FROM T1) SELECT * FROM n WHERE a > 0;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL;
SELECT STRING_AGG(b) FROM T1;
ROLLBACK TO sp873;
RELEASE sp873;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1) SELECT * FROM cnt;
END TRANSACTION;
ROLLBACK;
BEGIN EXCLUSIVE;
BEGIN DEFERRED;
SAVEPOINT sp873;
BEGIN TRANSACTION;
PRAGMA quick_check(CAST(1.0 AS INTEGER));
.exit
SAVEPOINT sp9184;
SAVEPOINT sp1810;
CREATE TABLE T1 (
  a FLOAT,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b /**/ TEXT
);
INSERT INTO T1 VALUES (1,'' || ('a')),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE NOT T2.a=T1.a
) AS c
FROM /* PRAGMA pragma_list; */ T1;
SELECT * FROM T2 AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL),  SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T1;
ROLLBACK TRANSACTION TO SAVEPOINT sp1810;
RELEASE SAVEPOINT sp1810;
INSERT OR IGNORE INTO T2 VALUES (0, 3);
ALTER TABLE T1 ADD COLUMN extra_3426 ANY DEFAULT 0;
INSERT INTO T2 DEFAULT VALUES;
ROLLBACK TO sp9184;
RELEASE sp9184;
DROP INDEX IF EXISTS T1;
ANALYZE;
COMMIT TRANSACTION;
ALTER TABLE T1 RENAME COLUMN b TO b_r7501;
SELECT MIN(a) FROM T2;
SELECT b FROM T1 EXCEPT SELECT b FROM (SELECT * FROM T1) AS sub;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL RETURNING *;
PRAGMA locking_mode;
CREATE  INDEX IF NOT EXISTS idx_T1_2051 ON T1(b COLLATE NOCASE);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_8990 ON T1(lower(a));
WITH n AS NOT MATERIALIZED (SELECT * FROM T1) SELECT * FROM n WHERE a > 0;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL;
SELECT STRING_AGG(b) FROM T1;
ROLLBACK TO sp873;
RELEASE sp873;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1) SELECT * FROM cnt;
END TRANSACTION;
ROLLBACK;
BEGIN EXCLUSIVE;
BEGIN DEFERRED;
SAVEPOINT sp873;
BEGIN TRANSACTION;
PRAGMA quick_check(CAST(1.0 AS INTEGER));
.exit
SAVEPOINT sp9184;
SAVEPOINT sp1810;
CREATE TABLE T1 (
  a FLOAT,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b /**/ TEXT
);
INSERT INTO T1 VALUES (1,'' || ('a')),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE NOT T2.a=T1.a
) AS c
FROM /* PRAGMA pragma_list; */ T1;
SELECT * FROM T2 AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL),  SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T1;
ROLLBACK TRANSACTION TO SAVEPOINT sp1810;
RELEASE SAVEPOINT sp1810;
INSERT OR IGNORE INTO T2 VALUES (0, 3);
ALTER TABLE T1 ADD COLUMN extra_3426 ANY DEFAULT 0;
INSERT INTO T2 DEFAULT VALUES;
ROLLBACK TO sp9184;
RELEASE sp9184;
DROP INDEX IF EXISTS T1;
ANALYZE;
COMMIT TRANSACTION;
ALTER TABLE T1 RENAME COLUMN b TO b_r7501;
SELECT MIN(a) FROM T2;
SELECT b FROM T1 EXCEPT SELECT b FROM (SELECT * FROM T1) AS sub;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL RETURNING *;
PRAGMA locking_mode;
CREATE  INDEX IF NOT EXISTS idx_T1_2051 ON T1(b COLLATE NOCASE);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_8990 ON T1(lower(a));
WITH n AS NOT MATERIALIZED (SELECT * FROM T1) SELECT * FROM n WHERE a > 0;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL;
SELECT STRING_AGG(b) FROM T1;
ROLLBACK TO sp873;
RELEASE sp873;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1) SELECT * FROM cnt;
END TRANSACTION;
ROLLBACK;
BEGIN EXCLUSIVE;
BEGIN DEFERRED;
SAVEPOINT sp873;
BEGIN TRANSACTION;
PRAGMA quick_check(CAST(1.0 AS INTEGER));
.exit
SAVEPOINT sp9184;
SAVEPOINT sp1810;
CREATE TABLE T1 (
  a FLOAT,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b /**/ TEXT
);
INSERT INTO T1 VALUES (1,'' || ('a')),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE NOT T2.a=T1.a
) AS c
FROM /* PRAGMA pragma_list; */ T1;
SELECT * FROM T2 AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL),  SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T1;
ROLLBACK TRANSACTION TO SAVEPOINT sp1810;
RELEASE SAVEPOINT sp1810;
INSERT OR IGNORE INTO T2 VALUES (0, 3);
ALTER TABLE T1 ADD COLUMN extra_3426 ANY DEFAULT 0;
INSERT INTO T2 DEFAULT VALUES;
ROLLBACK TO sp9184;
RELEASE sp9184;
DROP INDEX IF EXISTS T1;
ANALYZE;
COMMIT TRANSACTION;
ALTER TABLE T1 RENAME COLUMN b TO b_r7501;
SELECT MIN(a) FROM T2;
SELECT b FROM T1 EXCEPT SELECT b FROM (SELECT * FROM T1) AS sub;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL RETURNING *;
PRAGMA locking_mode;
CREATE  INDEX IF NOT EXISTS idx_T1_2051 ON T1(b COLLATE NOCASE);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_8990 ON T1(lower(a));
WITH n AS NOT MATERIALIZED (SELECT * FROM T1) SELECT * FROM n WHERE a > 0;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL;
SELECT STRING_AGG(b) FROM T1;
ROLLBACK TO sp873;
RELEASE sp873;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1) SELECT * FROM cnt;
END TRANSACTION;
ROLLBACK;
BEGIN EXCLUSIVE;
BEGIN DEFERRED;
SAVEPOINT sp873;
BEGIN TRANSACTION;
PRAGMA quick_check(CAST(1.0 AS INTEGER));
.exit
SAVEPOINT sp9184;
SAVEPOINT sp1810;
CREATE TABLE T1 (
  a FLOAT,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b /**/ TEXT
);
INSERT INTO T1 VALUES (1,'' || ('a')),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE NOT T2.a=T1.a
) AS c
FROM /* PRAGMA pragma_list; */ T1;
SELECT * FROM T2 AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL),  SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T1;
ROLLBACK TRANSACTION TO SAVEPOINT sp1810;
RELEASE SAVEPOINT sp1810;
INSERT OR IGNORE INTO T2 VALUES (0, 3);
ALTER TABLE T1 ADD COLUMN extra_3426 ANY DEFAULT 0;
INSERT INTO T2 DEFAULT VALUES;
ROLLBACK TO sp9184;
RELEASE sp9184;
DROP INDEX IF EXISTS T1;
ANALYZE;
COMMIT TRANSACTION;
ALTER TABLE T1 RENAME COLUMN b TO b_r7501;
SELECT MIN(a) FROM T2;
SELECT b FROM T1 EXCEPT SELECT b FROM (SELECT * FROM T1) AS sub;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL RETURNING *;
PRAGMA locking_mode;
CREATE  INDEX IF NOT EXISTS idx_T1_2051 ON T1(b COLLATE NOCASE);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_8990 ON T1(lower(a));
WITH n AS NOT MATERIALIZED (SELECT * FROM T1) SELECT * FROM n WHERE a > 0;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL;
SELECT STRING_AGG(b) FROM T1;
ROLLBACK TO sp873;
RELEASE sp873;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1) SELECT * FROM cnt;
END TRANSACTION;
ROLLBACK;
BEGIN EXCLUSIVE;
BEGIN DEFERRED;
SAVEPOINT sp873;
BEGIN TRANSACTION;
PRAGMA quick_check(CAST(1.0 AS INTEGER));
.exit
SAVEPOINT sp9184;
SAVEPOINT sp1810;
CREATE TABLE T1 (
  a FLOAT,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b /**/ TEXT
);
INSERT INTO T1 VALUES (1,'' || ('a')),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE NOT T2.a=T1.a
) AS c
FROM /* PRAGMA pragma_list; */ T1;
SELECT * FROM T2 AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL),  SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T1;
ROLLBACK TRANSACTION TO SAVEPOINT sp1810;
RELEASE SAVEPOINT sp1810;
INSERT OR IGNORE INTO T2 VALUES (0, 3);
ALTER TABLE T1 ADD COLUMN extra_3426 ANY DEFAULT 0;
INSERT INTO T2 DEFAULT VALUES;
ROLLBACK TO sp9184;
RELEASE sp9184;
DROP INDEX IF EXISTS T1;
ANALYZE;
COMMIT TRANSACTION;
ALTER TABLE T1 RENAME COLUMN b TO b_r7501;
SELECT MIN(a) FROM T2;
SELECT b FROM T1 EXCEPT SELECT b FROM (SELECT * FROM T1) AS sub;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL RETURNING *;
PRAGMA locking_mode;
CREATE  INDEX IF NOT EXISTS idx_T1_2051 ON T1(b COLLATE NOCASE);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_8990 ON T1(lower(a));
WITH n AS NOT MATERIALIZED (SELECT * FROM T1) SELECT * FROM n WHERE a > 0;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL;
SELECT STRING_AGG(b) FROM T1;
ROLLBACK TO sp873;
RELEASE sp873;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1) SELECT * FROM cnt;
END TRANSACTION;
ROLLBACK;
BEGIN EXCLUSIVE;
BEGIN DEFERRED;
SAVEPOINT sp873;
BEGIN TRANSACTION;
PRAGMA quick_check(CAST(1.0 AS INTEGER));
.exit
SAVEPOINT sp9184;
SAVEPOINT sp1810;
CREATE TABLE T1 (
  a FLOAT,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b /**/ TEXT
);
INSERT INTO T1 VALUES (1,'' || ('a')),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE NOT T2.a=T1.a
) AS c
FROM /* PRAGMA pragma_list; */ T1;
SELECT * FROM T2 AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL),  SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T1;
ROLLBACK TRANSACTION TO SAVEPOINT sp1810;
RELEASE SAVEPOINT sp1810;
INSERT OR IGNORE INTO T2 VALUES (0, 3);
ALTER TABLE T1 ADD COLUMN extra_3426 ANY DEFAULT 0;
INSERT INTO T2 DEFAULT VALUES;
ROLLBACK TO sp9184;
RELEASE sp9184;
DROP INDEX IF EXISTS T1;
ANALYZE;
COMMIT TRANSACTION;
ALTER TABLE T1 RENAME COLUMN b TO b_r7501;
SELECT MIN(a) FROM T2;
SELECT b FROM T1 EXCEPT SELECT b FROM (SELECT * FROM T1) AS sub;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL RETURNING *;
PRAGMA locking_mode;
CREATE  INDEX IF NOT EXISTS idx_T1_2051 ON T1(b COLLATE NOCASE);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_8990 ON T1(lower(a));
WITH n AS NOT MATERIALIZED (SELECT * FROM T1) SELECT * FROM n WHERE a > 0;
UPDATE T2 SET a = json_object('k', a) WHERE a IS NOT NULL;
SELECT STRING_AGG(b) FROM T1;
ROLLBACK TO sp873;
RELEASE sp873;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1) SELECT * FROM cnt;
END TRANSACTION;
ROLLBACK;

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
DELETE FROM t1 WHERE d IS NULL;
INSERT INTO T2 VALUES (NULL, NULL);

SELECT COUNT(*) FROM T2;
SELECT LEAD(b, 1, NULL) OVER (ORDER BY b) FROM T2;
REINDEX T2;
ALTER TABLE T1 RENAME COLUMN a TO a_r6095;
```

## Actual output

```sql
3.39.0 2022-05-10 23:28:12 764b71267e0b31ff7eaf2a0def7526a1a02dce4d5b456dea060d97ed342ealt1
```

## Expectation

```sql
3.51.1 2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88 (64-bit)
```

## Flag

```
-version
```

