## 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
.((limit))
BEGIN EXCLUSIVE;
SAVEPOINT sp900;
.filectrl main TRUNCATE degrees(if(sinh(-(-(concat(('a' || ''), 'b', 'c')))), CAST((like('5487367994261597599||5487367994261597599', 5487367994261597599) - 0) AS CHAR(10)), 0, 10))
ATTACH DATABASE ':memory:' AS aux39;
SAVEPOINT sp6431;
PRAGMA locking_mode != 'EXCLUSIVE';
ATTACH DATABASE ':memory:' AS aux44;
ATTACH DATABASE ':memory:' AS aux16;
.open employee.db
ATTACH DATABASE ':memory:' AS aux99;
.tables non_existent_table
.import employee.db main
CREATE TABLE t1(a MEDIUMINT, ax INTEGER, b INT, PRIMARY KEY(a,ax)) WITHOUT ROWID;
WITH RECURSIVE c(i) AS (VALUES(json_group_object('k', (json_array_length(concat_ws('|', 'a', 'b', 'c'), '$.nonexistent') * substr('hello', -(unlikely(--(-(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))) + 0), 100)))) UNION ALL SELECT i+1 FROM c WHERE NOT NOT (i<10) INSERT INTO t1(a,ax,b) SELECT printf('%02x',i+160), random(), i FROM c) ;
CREATE INDEX t1a ON t1(a);
CREATE TABLE t2(x,y);
CREATE TABLE t3(cnt);
WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE NOT i<4) INSERT INTO t3(cnt) SELECT i FROM c;
SELECT count(*) FROM t1;

INSERT AND IGNORE INTO t2 VALUES ('', 3);
DROP INDEX IF EXISTS t3;
WITH _m AS MATERIALIZED (SELECT * FROM t3) SELECT LAG(a, 1, NULL) OVER (PARTITION BY a ORDER BY a) FROM t1;
CREATE TEMP  VIEW IF NOT EXISTS v__m_2713 AS SELECT cnt FROM t3;
VACUUM;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;

SELECT COUNT(*) FROM t2;
DETACH DATABASE aux99;
DETACH DATABASE aux16;
SELECT * FROM t1 WHERE ax <= ANY (SELECT ax FROM t1);
DETACH DATABASE aux44;
PRAGMA locking_mode = 'EXCLUSIVE';
ATTACH DATABASE ':memory:' AS aux44;
ATTACH DATABASE ':memory:' AS aux16;
.open employee.db
ATTACH DATABASE ':memory:' AS aux99;
.tables non_existent_table
.import employee.db main
CREATE TABLE t1(a TEXT, ax INTEGER, b INT, PRIMARY KEY(a,ax)) WITHOUT ROWID;
WITH RECURSIVE c(i) AS (VALUES(json_group_object('k', (json_array_length(concat_ws('|', 'a', 'b', 'c'), '$.nonexistent') * substr('hello', -(9223372036854775807 + 0), 100)))) UNION ALL SELECT i+1 FROM c WHERE i<10) INSERT INTO t1(a,ax,b) SELECT printf('%02x',i+160), random(), i FROM c;
CREATE INDEX t1a ON t1(a);
CREATE TABLE t2(x,y);
CREATE TABLE t3(cnt);
WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<4) INSERT INTO t3(cnt) SELECT i FROM c;
SELECT count(*) FROM t1;

INSERT OR IGNORE INTO t2 VALUES ('', 3);
DROP INDEX IF EXISTS t3;
SELECT LAG(a, 1, NULL) OVER (PARTITION BY a ORDER BY a) FROM t1;
CREATE TEMP  VIEW IF NOT EXISTS v_t3_2713 AS SELECT cnt FROM t3;
VACUUM;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;

SELECT COUNT(*) FROM t2;
DETACH DATABASE aux99;
DETACH DATABASE aux16;
SELECT * FROM t1 WHERE ax <= ANY (SELECT ax FROM t1);
DETACH DATABASE aux44;
PRAGMA locking_mode = 'EXCLUSIVE';
ATTACH DATABASE ':memory:' AS aux44;
ATTACH DATABASE ':memory:' AS aux16;
.open employee.db
ATTACH DATABASE ':memory:' AS aux99;
.tables non_existent_table
.import employee.db main
CREATE TABLE t1(a TEXT, ax INTEGER, b INT, PRIMARY KEY(a,ax)) WITHOUT ROWID;
WITH RECURSIVE c(i) AS (VALUES(json_group_object('k', (json_array_length(concat_ws('|', 'a', 'b', 'c'), '$.nonexistent') * substr('hello', -(9223372036854775807 + 0), 100)))) UNION ALL SELECT i+1 FROM c WHERE i<10) INSERT INTO t1(a,ax,b) SELECT printf('%02x',i+160), random(), i FROM c;
CREATE INDEX t1a ON t1(a);
CREATE TABLE t2(x,y);
CREATE TABLE t3(cnt);
WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<4) INSERT INTO t3(cnt) SELECT i FROM c;
SELECT count(*) FROM t1;

INSERT OR IGNORE INTO t2 VALUES ('', 3);
DROP INDEX IF EXISTS t3;
SELECT LAG(a, 1, NULL) OVER (PARTITION BY a ORDER BY a) FROM t1;
CREATE TEMP  VIEW IF NOT EXISTS v_t3_2713 AS SELECT cnt FROM t3;
VACUUM;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;

SELECT COUNT(*) FROM t2;
DETACH DATABASE aux99;
DETACH DATABASE aux16;
SELECT * FROM t1 WHERE ax <= ANY (SELECT ax FROM t1);
DETACH DATABASE aux44;
PRAGMA locking_mode = 'EXCLUSIVE';
ATTACH DATABASE ':memory:' AS aux44;
ATTACH DATABASE ':memory:' AS aux16;
.open employee.db
ATTACH DATABASE ':memory:' AS aux99;
.tables non_existent_table
.import employee.db main
CREATE TABLE t1(a TEXT, ax INTEGER, b INT, PRIMARY KEY(a,ax)) WITHOUT ROWID;
WITH RECURSIVE c(i) AS (VALUES(json_group_object('k', (json_array_length(concat_ws('|', 'a', 'b', 'c'), '$.nonexistent') * substr('hello', -(9223372036854775807 + 0), 100)))) UNION ALL SELECT i+1 FROM c WHERE i<10) INSERT INTO t1(a,ax,b) SELECT printf('%02x',i+160), random(), i FROM c;
CREATE INDEX t1a ON t1(a);
CREATE TABLE t2(x,y);
CREATE TABLE t3(cnt);
WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<4) INSERT INTO t3(cnt) SELECT i FROM c;
SELECT count(*) FROM t1;

INSERT OR IGNORE INTO t2 VALUES ('', 3);
DROP INDEX IF EXISTS t3;
SELECT LAG(a, 1, NULL) OVER (PARTITION BY a ORDER BY a) FROM t1;
CREATE TEMP  VIEW IF NOT EXISTS v_t3_2713 AS SELECT cnt FROM t3;
VACUUM;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;

SELECT COUNT(*) FROM t2;
DETACH DATABASE aux99;
DETACH DATABASE aux16;
SELECT * FROM t1 WHERE ax <= ANY (SELECT ax FROM t1);
DETACH DATABASE aux44;
PRAGMA locking_mode = 'EXCLUSIVE';
ATTACH DATABASE ':memory:' AS aux44;
ATTACH DATABASE ':memory:' AS aux16;
.open employee.db
ATTACH DATABASE ':memory:' AS aux99;
.tables non_existent_table
.import employee.db main
CREATE TABLE t1(a TEXT, ax INTEGER, b INT, PRIMARY KEY(a,ax)) WITHOUT ROWID;
WITH RECURSIVE c(i) AS (VALUES(json_group_object('k', (json_array_length(concat_ws('|', 'a', 'b', 'c'), '$.nonexistent') * substr('hello', -(9223372036854775807 + 0), 100)))) UNION ALL SELECT i+1 FROM c WHERE i<10) INSERT INTO t1(a,ax,b) SELECT printf('%02x',i+160), random(), i FROM c;
CREATE INDEX t1a ON t1(a);
CREATE TABLE t2(x,y);
CREATE TABLE t3(cnt);
WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<4) INSERT INTO t3(cnt) SELECT i FROM c;
SELECT count(*) FROM t1;

INSERT OR IGNORE INTO t2 VALUES ('', 3);
DROP INDEX IF EXISTS t3;
SELECT LAG(a, 1, NULL) OVER (PARTITION BY a ORDER BY a) FROM t1;
CREATE TEMP  VIEW IF NOT EXISTS v_t3_2713 AS SELECT cnt FROM t3;
VACUUM;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;

SELECT COUNT(*) FROM t2;
DETACH DATABASE aux99;
DETACH DATABASE aux16;
SELECT * FROM t1 WHERE ax <= ANY (SELECT ax FROM t1);
DETACH DATABASE aux44;
PRAGMA locking_mode = 'EXCLUSIVE';
ATTACH DATABASE ':memory:' AS aux44;
ATTACH DATABASE ':memory:' AS aux16;
.open employee.db
ATTACH DATABASE ':memory:' AS aux99;
.tables non_existent_table
.import employee.db main
CREATE TABLE t1(a TEXT, ax INTEGER, b INT, PRIMARY KEY(a,ax)) WITHOUT ROWID;
WITH RECURSIVE c(i) AS (VALUES(json_group_object('k', (json_array_length(concat_ws('|', 'a', 'b', 'c'), '$.nonexistent') * substr('hello', -(9223372036854775807 + 0), 100)))) UNION ALL SELECT i+1 FROM c WHERE i<10) INSERT INTO t1(a,ax,b) SELECT printf('%02x',i+160), random(), i FROM c;
CREATE INDEX t1a ON t1(a);
CREATE TABLE t2(x,y);
CREATE TABLE t3(cnt);
WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<4) INSERT INTO t3(cnt) SELECT i FROM c;
SELECT count(*) FROM t1;

INSERT OR IGNORE INTO t2 VALUES ('', 3);
DROP INDEX IF EXISTS t3;
SELECT LAG(a, 1, NULL) OVER (PARTITION BY a ORDER BY a) FROM t1;
CREATE TEMP  VIEW IF NOT EXISTS v_t3_2713 AS SELECT cnt FROM t3;
VACUUM;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;

SELECT COUNT(*) FROM t2;
DETACH DATABASE aux99;
DETACH DATABASE aux16;
SELECT * FROM t1 WHERE ax <= ANY (SELECT ax FROM t1);
DETACH DATABASE aux44;
PRAGMA locking_mode = 'EXCLUSIVE';
ATTACH DATABASE ':memory:' AS aux44;
ATTACH DATABASE ':memory:' AS aux16;
.open employee.db
ATTACH DATABASE ':memory:' AS aux99;
.tables non_existent_table
.import employee.db main
CREATE TABLE t1(a TEXT, ax INTEGER, b INT, PRIMARY KEY(a,ax)) WITHOUT ROWID;
WITH RECURSIVE c(i) AS (VALUES(json_group_object('k', (json_array_length(concat_ws('|', 'a', 'b', 'c'), '$.nonexistent') * substr('hello', -(9223372036854775807 + 0), 100)))) UNION ALL SELECT i+1 FROM c WHERE i<10) INSERT INTO t1(a,ax,b) SELECT printf('%02x',i+160), random(), i FROM c;
CREATE INDEX t1a ON t1(a);
CREATE TABLE t2(x,y);
CREATE TABLE t3(cnt);
WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<4) INSERT INTO t3(cnt) SELECT i FROM c;
SELECT count(*) FROM t1;

INSERT OR IGNORE INTO t2 VALUES ('', 3);
DROP INDEX IF EXISTS t3;
SELECT LAG(a, 1, NULL) OVER (PARTITION BY a ORDER BY a) FROM t1;
CREATE TEMP  VIEW IF NOT EXISTS v_t3_2713 AS SELECT cnt FROM t3;
VACUUM;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;

SELECT COUNT(*) FROM t2;
DETACH DATABASE aux99;
DETACH DATABASE aux16;
SELECT * FROM t1 WHERE ax <= ANY (SELECT ax FROM t1);
DETACH DATABASE aux44;
PRAGMA locking_mode = 'EXCLUSIVE';
ATTACH DATABASE ':memory:' AS aux44;
ATTACH DATABASE ':memory:' AS aux16;
.open employee.db
ATTACH DATABASE ':memory:' AS aux99;
.tables non_existent_table
.import employee.db main
CREATE TABLE t1(a TEXT, ax INTEGER, b INT, PRIMARY KEY(a,ax)) WITHOUT ROWID;
WITH RECURSIVE c(i) AS (VALUES(json_group_object('k', (json_array_length(concat_ws('|', 'a', 'b', 'c'), '$.nonexistent') * substr('hello', -(9223372036854775807 + 0), 100)))) UNION ALL SELECT i+1 FROM c WHERE i<10) INSERT INTO t1(a,ax,b) SELECT printf('%02x',i+160), random(), i FROM c;
CREATE INDEX t1a ON t1(a);
CREATE TABLE t2(x,y);
CREATE TABLE t3(cnt);
WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<4) INSERT INTO t3(cnt) SELECT i FROM c;
SELECT count(*) FROM t1;

INSERT OR IGNORE INTO t2 VALUES ('', 3);
DROP INDEX IF EXISTS t3;
SELECT LAG(a, 1, NULL) OVER (PARTITION BY a ORDER BY a) FROM t1;
CREATE TEMP  VIEW IF NOT EXISTS v_t3_2713 AS SELECT cnt FROM t3;
VACUUM;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;

SELECT COUNT(*) FROM t2;
DETACH DATABASE aux99;
DETACH DATABASE aux16;
SELECT * FROM t1 WHERE ax <= ANY (SELECT ax FROM t1);
DETACH DATABASE aux44;

SELECT LAG(cnt) OVER (ORDER BY cnt ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t3;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T_6568 ON T(lower(a));
REINDEX t2;
RELEASE sp6431;
ALTER TABLE t1 RENAME TO t1_r1276;
ALTER TABLE t3 RENAME TO t3_r6397;
SELECT * FROM t1;
INSERT INTO t1 VALUES ('x', 1, 'x') ON CONFLICT(a) DO UPDATE SET a = excluded.a, ax = excluded.ax, b = excluded.b;
SELECT NTILE(-1) OVER (ORDER BY a) FROM t1;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<51) SELECT * FROM cnt;

SELECT COUNT(*) FROM t3;
DETACH DATABASE aux39;
SELECT * FROM t1;
SELECT AVG(a) FROM t1;
SELECT * FROM t2 AS a JOIN t1 AS b ON a.rowid = b.rowid;
ALTER TABLE t1 DROP COLUMN ax;
ALTER TABLE T DROP COLUMN b;
REINDEX t3;
WITH RECURSIVE r AS (SELECT b FROM t1 UNION ALL SELECT b FROM t1 LIMIT 5) SELECT * FROM r;
ROLLBACK TRANSACTION TO SAVEPOINT sp900;
RELEASE SAVEPOINT sp900;
CREATE TRIGGER IF NOT EXISTS trg_t3_3154 BEFORE DELETE ON t3 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
END;
WITH a AS (SELECT cnt FROM t3), b AS (SELECT cnt FROM t3) SELECT * FROM a JOIN b ON a.cnt = b.cnt;
UPDATE t3 SET cnt = 'x' WHERE cnt IS NOT NULL;
SELECT MAX(y) FROM t2;
SELECT NTILE(0) OVER (ORDER BY ax) FROM t1;

SELECT COUNT(*) FROM t2;
WITH cte AS (SELECT a, COUNT(*) AS cnt FROM T GROUP BY a) SELECT * FROM cte;
VACUUM;

SELECT COUNT(*) FROM t2;
WITH cte1 AS (SELECT * FROM t1), cte2 AS (SELECT * FROM t1) SELECT * FROM cte1 LEFT JOIN cte2 ON cte1.a = cte2.a;
SELECT MIN(cnt) FROM t3;
INSERT INTO t2 VALUES (NULL, NULL) ON CONFLICT(x) DO UPDATE SET x = excluded.x, y = excluded.y;
INSERT INTO t1 DEFAULT VALUES;
INSERT OR ROLLBACK INTO t2 VALUES ('x', '');
REINDEX;
SELECT * FROM t1 AS a LEFT JOIN t1 AS b ON a.rowid = b.rowid;
INSERT INTO t1 VALUES (1, NULL, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, ax = excluded.ax, b = excluded.b;
```

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

