## 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 TRANSACTION;
.eqp full
ATTACH DATABASE '' || ('') || ('') || (':memory:') AS aux52;
creATE VIRTUAL TABLE t0 USING fts3("x", "y", "z");
DROP TABLE t0;
BEGIN;
ATTACH DATABASE ':memory:' AS aux3;
.vfsinfo
SAVEPOINT sp4409;
ATTACH DATABASE ':memory:' AS aux60;
.exit
((PRAGMA)) locking_mode <= 'EXCLUSIVE';
BEGIN DEFERRED TRANSACTION;
.system echo "mwahaha i am root"
ATTACH DATABASE ((':memory:' || '') || '') AS aux36;
.eqp on
.clone new_db
SAVEPOINT sp6007;
CREATE TABLE [t1](a CHAR(max('a', 'b', 'c')) PRECISION PRIMARY KEY, b TEXT, c INT, d INT);
-- PRAGMA short_column_names;
INSERT INTO t1 VALUES (x'7b90b0351e531a0993e701583bc65b31', '' || ('Wernher'), 'ÅÄÖËŸÏaáàưôốồỗổộơớờỡởợđ', if('NaN', strftime('%Y-%m-%d', format('%s', NULL)), json_remove((NULL + CAST(-(-(x'6f7645cd7bee60afea791c')) AS DECIMAL((-round(sinh(-like(x'a85eeee4f28c6f', sqrt(json_object()), NULL))) + CAST(x'c88d' AS DATE)),random() % concat('text', sqrt(NULL), NULL)))), '$.key', '$[0]'), -(-(100)), 1, 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

WITH "_m" AS MATERIALIZED (SELECT * FROM T1) SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
SAVEPOINT sp9475;
SELECT -if(0, 2, 1, 2)147483648x0ACB29BM205381;
SELECT sqlite_compileoption_used('æçå¤©ä½ æ¯æä¹äº');
SELECT 1 >> -999999999999999999999999999;
SELECT sqlite_compileoption_get($1);
WITH _m AS MATERIALIZED (SELECT * FROM main.main.T) SELEC_m sqlite_version();
CREATE TABLE main.main."T" (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
WITH _m AS MATERIALIZED (SELECT * FROM T) SELEC_m * FROM T WHERE NOT NOT (NOT NOT (NOT NOT (NOT NOT (b < 2.0)))) ORDER BY b;
INSERT INTO T DEFAULT VALUES;
DELETE FROM T WHERE +rowid = 35 RETURNING *;
ROLLBACK TO sp9475;
RELEASE sp9475;
SELECT TOTAL(b) FROM T;
ALTER TABLE T ADD COLUMN extra_1915 DATE COLLATE NOCASE;
SELECT * FROM (SELECT * FROM T) AS sub;
SELECT COUNT(*) FROM T;
SELECT * FROM T AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
WITH cte AS (SELECT CASE WHEN a > 0 THEN "pos" ELSE "neg" END AS sign FROM T) SELECT * FROM cte;
CREATE VIRTUAL TABLE T
USING /* char(-1) */ fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
CREATE TABLE _m (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10),
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 EXCEPT SELECT A FROM T2;
SELECT a,b FROM T WHERE T MATCH 'b';
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T;
ALTER TABLE t1 ADD COLUMN extra_5180 BOOLEAN DEFAULT '';
CREATE /**/ TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b',5.0), ('a','c',5.0), ('b','d',-8.25);
SELECT a,b,c,
RANK() OVER (PARTITION BY a ORDER BY c DESC) AS d FROM T;
UPDATE T SET a = 'x' WHERE a BETWEEN 0 OR 100;
SELECT * FROM (SELECT * FROM (SELECT * FROM T) AS inner1) AS inner2;
CREATE TABLE T (
  A VARCHAR(20),
  B VARCHAR(10),
  C INTEGER,
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p', -2147483648);
INSERT INTO T VALUES ('b', 'q', 100);
INSERT INTO T VALUES ('b', 'r', 200);
INSERT INTO T VALUES ('c', 's', 300);
INSERT INTO T VALUES ('d', 't', 2147483647);
INSERT INTO T VALUES ('b', 't', 50);
SELECT A, COUNT(*) AS D, SUM(C) AS E FROM T GROUP BY A HAVING COUNT(*) > 1;
DELETE FROM t1 WHERE d IS NULL;
ALTER TABLE t1 ADD COLUMN extra_7051 TINYINT DEFAULT '';
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b',1.0), ('a','c',-1.0), ('b','d',0.0);
SELECT
COALESCE(a,'e') AS d,
COALESCE(b,'f') AS e,
SUM(c) AS f
FROM T
GROUP BY a,b;
RELEASE sp6007;
ALTER TABLE T RENAME COLUMN A TO A_r533;
CREATE  INDEX IF NOT EXISTS idx_t1_6721 ON t1(lower(c));
UPDATE t1 SET b = CURRENT_TIMESTAMP WHERE +rowid = 1;
SELECT * FROM T;
SELECT C FROM T EXCEPT SELECT C FROM (SELECT * FROM T) AS sub;
INSERT INTO T VALUES (NULL, 'x', 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
SELECT * FROM T;
CREATE  INDEX IF NOT EXISTS idx_t1_3859 ON t1((b + 1));
INSERT OR ABORT INTO T VALUES ('x', '', '');
INSERT INTO T VALUES (NULL, NULL, NULL);
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE +x<16) SELECT COUNT(*) FROM cnt;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T;
SELECT LAG(c, 2, c) OVER (ORDER BY c ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T;
ANALYZE t1;
DROP INDEX IF EXISTS T;
ALTER TABLE T ADD COLUMN extra_7325 INT8 COLLATE NOCASE;
ALTER TABLE T2 RENAME COLUMN A TO A_r6005;
REINDEX T2;
DETACH DATABASE aux36;
WITH cte AS (SELECT A, ROW_NUMBER() OVER (ORDER BY A) AS rn FROM T2) SELECT * FROM cte WHERE rn <= 5;
CREATE  VIEW IF NOT EXISTS v_T2_7058 AS SELECT Y FROM T2;
SELECT LAG(b) OVER (PARTITION BY b ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
DROP INDEX IF EXISTS T2;
INSERT INTO T VALUES (NULL, NULL, 1) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
CREATE TRIGGER IF NOT EXISTS trg_T1_1558 BEFORE UPDATE OF X ON T1 BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T2;
DELETE FROM T2 WHERE A > (SELECT AVG(A) FROM T2) RETURNING *;
UPDATE T SET c = json_object('k', c);
INSERT OR IGNORE INTO t1 VALUES ('x', 0, 0, 1);
CREATE  INDEX IF NOT EXISTS idx_t1_2630 ON t1(lower(c)) WHERE c IS NOT NULL;
ANALYZE T1;
ALTER TABLE T1 ADD COLUMN extra_1981 SMALLINT UNIQUE;
CREATE TEMP  VIEW IF NOT EXISTS v_T2_4122 AS SELECT A FROM T2;
SELECT * FROM T2 AS a LEFT JOIN t1 AS b ON a.rowid = b.rowid;
ALTER TABLE t1 ADD COLUMN extra_5945 VARCHAR(255) DEFAULT '';
VACUUM main;
SELECT * FROM t1 AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
SELECT LAG(d, 1) OVER (PARTITION BY d ORDER BY d RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM t1;
COMMIT; /**/ DELETE FROM t1 WHERE 0 RETURNING *;
SELECT * FROM T1 WHERE X IN (SELECT X FROM T1 WHERE ROW_NUMBER() OVER (ORDER BY X) = 1);
WITH RECURSIVE vals(x) AS (SELECT b FROM t1 WHERE b IS NOT NULL UNION ALL SELECT b FROM t1 WHERE b IS NOT NULL LIMIT 10) SELECT * FROM vals;
SELECT * FROM T WHERE b <= ALL (SELECT b FROM T);
CREATE TEMP  VIEW IF NOT EXISTS v_T_3872 AS SELECT a FROM T;
INSERT OR FAIL INTO T VALUES ('', 0, NULL);
PRAGMA journal_size_limit = 1000000;
DELETE FROM T2 WHERE Y > (SELECT AVG(Y) FROM T2);
WITH cte AS (SELECT Y FROM T2 INTERSECT SELECT Y FROM T2) SELECT * FROM cte;
ALTER TABLE T RENAME TO T_r7324;
INSERT INTO T2 VALUES (1, 1) ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
WITH cte AS (SELECT DISTINCT X FROM T1) SELECT * FROM cte;
PRAGMA ignore_check_constraints = 1;
ALTER TABLE T1 RENAME COLUMN X TO X_r8277;
SELECT COUNT(*) FILTER (WHERE A IS NOT NULL), SUM(rowid) FILTER (WHERE A > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(A) FILTER (WHERE A > 0 AND A < 100), COUNT(*) FILTER (WHERE typeof(A) = "text") FROM T1;
DELETE FROM T2 WHERE A > (SELECT AVG(A) FROM T2);
ANALYZE T;
ALTER TABLE T1 ADD COLUMN extra_1060 DATETIME COLLATE NOCASE;
SELECT * FROM T AS a JOIN T1 AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE rowid = 28 RETURNING *;
SELECT TOTAL(A) FROM T1;
DELETE FROM T1 WHERE 0 RETURNING *;
ALTER TABLE T2 ADD COLUMN extra_6664 NATIVE CHARACTER(70)NVARCHAR(100) DEFAULT NULL;
UPDATE T1 SET X = -88 WHERE rowid = 1;
VACUUM;
DELETE FROM T1 WHERE A > (SELECT AVG(A) FROM T1) RETURNING *;
DETACH DATABASE aux60;
INSERT OR ABORT INTO T2 VALUES (-9, -8);
SELECT * FROM T t1 JOIN (SELECT * FROM T) AS sub ON t1.a = sub.a;
SELECT * FROM T AS a LEFT OUTER JOIN _m AS b ON a.rowid = b.rowid;
ROLLBACK TO sp4409;
RELEASE sp4409;
SELECT COUNT(*) OVER (PARTITION BY c ORDER BY c RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM T;
VACUUM;
ALTER TABLE T RENAME COLUMN b TO b_r9589;
SELECT AVG(c) FROM T;
INSERT OR ROLLBACK INTO T VALUES (0, 0, NULL);
DETACH DATABASE aux3;
END TRANSACTION;
ALTER TABLE T DROP COLUMN b;
VACUUM main;
SELECT LAG(A, 0) OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM _m;
SELECT * FROM T;
SELECT COUNT(*) FILTER (WHERE Y IS NOT NULL), SUM(rowid) FILTER (WHERE Y > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(Y) FILTER (WHERE Y > 0 AND Y < 100), COUNT(*) FILTER (WHERE typeof(Y) = "text") FROM T2;

SELECT COUNT(*) FROM _m;
INSERT INTO T DEFAULT VALUES;
PRAGMA read_uncommitted = NO;
DETACH DATABASE aux52;
SELECT SUM(c) FILTER (WHERE c > 0) OVER (ORDER BY c ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T;
INSERT INTO T2 VALUES (NULL, NULL);
UPDATE T SET b = NULL RETURNING *;
VACUUM main;
VACUUM;
SELECT GROUP_CONCAT(A, '|') FROM _m;
ALTER TABLE _m ADD COLUMN extra_6262 BIGINT DEFAULT 0;
CREATE TABLE T (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15),
  C BIGINT,
  UNIQUE (B, C)
);
INSERT INTO T VALUES ('a', 'p', -9223372036854775808);
INSERT INTO T VALUES ('b', 'q', 4000);
INSERT INTO T VALUES ('c', 'r', 1700);
INSERT INTO T VALUES ('d', 'r', 9223372036854775807);
INSERT INTO T VALUES ('e', 's', 0);
SELECT A, C FROM T WHERE C > 1200 AND C < 9999999999 ORDER BY C;
SELECT SUM(X) FILTER (WHERE X > 0) OVER (ORDER BY X RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM _m;
SELECT ROW_NUMBER() OVER (ORDER BY A ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T;
ALTER TABLE _m DROP COLUMN X;
SELECT * FROM _m;
WITH cte AS (SELECT * FROM _m ORDER BY X LIMIT 5) SELECT * FROM cte;
VACUUM main;

SELECT COUNT(*) FROM T;
WITH cte AS (SELECT 1 AS x) INSERT INTO _m(X) SELECT x FROM cte WHERE 1=0;

SELECT COUNT(*) FROM _m;
ALTER TABLE T2 ADD COLUMN extra_1238 CHARACTER(20);
ALTER TABLE T ADD COLUMN extra_1246 DECIMAL(10,5) COLLATE NOCASE;
SELECT COUNT(*) FROM T2;
INSERT INTO T2 VALUES (NULL, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
WITH cte AS (SELECT * FROM T) SELECT * FROM cte JOIN T ON cte.A = T.A;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
INSERT INTO T2 VALUES (1, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
WITH cte AS (SELECT CASE WHEN A > 0 THEN "pos" ELSE "neg" END AS sign FROM T2) SELECT * FROM cte;
SELECT * FROM T AS a INNER JOIN T AS b ON a.rowid = b.rowid;
ALTER TABLE _m RENAME COLUMN X TO X_r2706;
SELECT SUM(B) OVER (ORDER BY B) FROM T;
CREATE  INDEX IF NOT EXISTS idx_T_1197 ON T(B) WHERE B IS NOT NULL;
INSERT OR ROLLBACK INTO _m VALUES (NULL, 'x');
INSERT INTO T SELECT * FROM T;
ROLLBACK;
```

## 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
```

