## 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 secure_delete;
PRAGMA query_only = NO;
PRAGMA legacy_alter_table = NO;
CREATE TABLE T (
  a NONE,
  b TEXT
);
INSERT INTO T VALUES ('a','b'), ('c','d');
SELECT * FROM T WHERE NOT a = REPLACE('a;',';','') OR b = 'b';
SAVEPOINT sp7688;
ATTACH DATABASE ':memory:' AS aux25;
SAVEPOINT sp4189;
SAVEPOINT sp2341;
PRAGMA synchronous = '1';
-- if(0, {v}, 0, {v})

SAVEPOINT sp2237;
PRAGMA cache_spill = replace(NULL, 'a', 'b');
ATTACH DATABASE ':memory:' AS aux62;
ATTACH DATABASE ':memory:' AS aux74;
PRAGMA recursive_triggers = mod(instr(NULL, -NULL), jsonb_object('k1', json_replace(pow(4579059385709312925, 4579059385709312925), '$.key', 4579059385709312925), 'k2', 4579059385709312925));
BEGIN TRANSACTION;
.import corrupt001.db main
.mode
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT --1472713692240534417;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -(NULL + (length(NULL) + CAST(octet_length(-(-(x'9f4e7c0cc2a4227879ec54e01c20a324'))) AS DOUBLE PRECISION)));
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT ('' || ('hello') || '');
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT *	FROM t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -json('🙂');
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -json_array_insert(load_extension((x'40509735801e9420b456ea14560259c3' + 0)), '$[0]', 123.5);
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT * FROM t1;
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;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE TABLE T (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(x'');
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
SELECT b, typeof(b) FROM t1;
ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'hello';
SELECT c, typeof(c) FROM t1;
INSERT INTO t1 SELECT * FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_1698 BEFORE UPDATE ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); EnD;
CREATE TRIGGER IF NOT EXISTS trg_t1_6049 BEFORE UPDATE ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
CREATE  VIEW IF NOT EXISTS v_t1_8840 AS SELECT a FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT OR ABORT INTO t1 VALUES (8);
WITH a AS (SELECT a FROM t1), b AS (SELECT a FROM t1) SELECT * FROM a JOIN b ON a.a = b.a;
WITH cte AS (SELECT * FROM t1 WHERE a IS NOT NULL) SELECT * FROM cte;
SELECT CUME_DIST() OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM t1;
ALTER TABLE t1 DROP COLUMN a;
INSERT INTO t1 VALUES ('x') ON CONFLICT(a) DO UPDATE SET a = excluded.a;
INSERT INTO t1 DEFAULT VALUES;
WITH RECURSIVE pair(a,b) AS (VALUES(0,1) UNION ALL SELECT b, a+b FROM pair WHERE +b<100) SELECT * FROM pair;
ALTER TABLE t1 ADD COLUMN extra_5500 UNSIGNED BIG INT DEFAULT CURRENT_TIMESTAMP;
ANALYZE;
DELETE FROM t1 WHERE rowid = 48;
SELECT * FROM T;
ALTER TABLE t1 ADD COLUMN extra_3172 FLOA;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<50) SELECT x FROM cnt WHERE x > 25;
COMMIT TRANSACTION;
REINDEX;
INSERT INTO T DEFAULT VALUES;
SELECT * FROM T AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
ANALYZE;
REINDEX;
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;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
DETACH DATABASE aux74;
SELECT * FROM t1 WHERE EXISTS (SELECT 1 FROM t1 WHERE a > 0);
INSERT OR IGNORE INTO t1 VALUES ('');
UPDATE t1 SET a = a + 1 WHERE a BETWEEN 0 AND 100;
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;
DETACH DATABASE aux62;
SELECT * FROM t1;
WITH cte AS (SELECT "123" AS x) SELECT x + 0 FROM cte;
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;
VACUUM;
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 T;
SELECT * FROM t1 NATURAL JOIN T;
CREATE  INDEX IF NOT EXISTS idx_T_2043 ON T(a) WHERE a IS NOT NULL;
SELECT COUNT(*) FROM T;
RELEASE sp2237;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T_9806 ON T((c + 1)) WHERE c IS NOT NULL;
INSERT INTO T VALUES (NULL, NULL, 'x', NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
CREATE TEMP  VIEW IF NOT EXISTS v_T_1070 AS SELECT a FROM T;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T_8226 ON T(c) WHERE c > 0;
ROLLBACK TRANSACTION TO SAVEPOINT sp2341;
RELEASE SAVEPOINT sp2341;
SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t1);
SELECT LAG(a, 2, 'default') OVER (ORDER BY a RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM T;
SELECT MAX(a) FILTER (WHERE a IS NOT NULL) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM T;
RELEASE sp4189;
ANALYZE;
DETACH DATABASE aux25;
SELECT COUNT(d) FROM T;
CREATE  INDEX IF NOT EXISTS idx_T_2193 ON T(d);
ANALYZE t1;
WITH cte AS (SELECT * FROM t1) SELECT * FROM cte LEFT JOIN t1 ON cte.a = t1.a;
SELECT * FROM T WHERE d = (SELECT d FROM T t2 WHERE t2.d = T.d LIMIT 1);
ROLLBACK TO sp7688;
RELEASE sp7688;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6472 AS SELECT a FROM T;
SELECT * FROM t1 AS a FULL JOIN T AS b ON a.rowid = b.rowid;
DROP TABLE IF EXISTS T;
DROP INDEX IF EXISTS T;
```

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

