## 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 vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (CAST(2 AS DOUBLE),-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA vdbe_addoptrace = OFF;
.read commands.sql
ATTACH DATABASE '' || (':memory:') AS aux12;
CREATE TABLE T (
  a INTEGER,
  b REAL
);
INSERT INTO T VALUES (length('hello'),unlikely((NULL + octet_length(NULL)))), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b > -2.5 AND b < 2.0;
PRAGMA read_uncommitted = ON;
PRAGMA count_changes = TRUE;
ATTACH DATABASE ':memory:' AS aux45;
PRAGMA case_sensitive_like = OFF;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
CREATE VIRTUAL TABLE T
USING fts5(a,b);
INSERT INTO T VALUES ('a','b c'), ('d','e f');
SELECT a,b FROM T WHERE T MATCH 'b';
INSERT INTO T VALUES ('a',1,2.0), ('a',2,-3.0), ('b',1,4.5);
SELECT a,b,c,
SUM(c) OVER (
  PARTITION BY a
  ORDER BY b
) AS d
FROM T;
ATTACH DATABASE ':memory:' AS aux73;
.tables
CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES ((104 * 1));
CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
CREATE TABLE "t4" (d); INSERT INTO t4 (d) VALUES (104);
SELECT * FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN ( SELECT t3.c FROM t3 WHERE t3.c IN ( SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104));
CREATE TABLE [t5](a, b, c, d);
CREATE INDEX t5a ON t5(a);
CREATE INDEX t5b ON t5(b);
CREATE TABLE t6(e);
INSERT INTO t6 VALUES(1);
INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN ( SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE +e=1);
INSERT INTO t5 SELECT * FROM t5;
CREATE TRIGGER IF NOT EXISTS trg_t6_355 AFTER UPDATE OF e ON t6 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT * FROM t4 WHERE d = (SELECT GROUP_CONCAT(d) FROM t4);
SELECT * FROM (SELECT e FROM t6 WHERE e IS NOT NULL) AS sub;
DETACH DATABASE aux73;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
CREATE TRIGGER IF NOT EXISTS trg_t1_7515 AFTER INSERT ON t1 FOR EACH ROW BEGIN INSERT INTO t1(a) VALUES (NULL); END;
SELECT * FROM t4;
DETACH DATABASE aux45;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t2 AS a INNER JOIN t4 AS b ON a.rowid = b.rowid;
SELECT * FROM t1;
SELECT * FROM t6 WHERE EXISTS (SELECT 1 FROM t6 WHERE e > 0);
UPDATE t4 SET d = 25 WHERE rowid = 1;
CREATE  VIEW IF NOT EXISTS v_t1_5037 AS SELECT a FROM t1;
DETACH DATABASE aux12;
DELETE FROM t3 WHERE 1;
SELECT * FROM t4 WHERE d IN (SELECT d FROM t4 WHERE d IS NULL);
ALTER TABLE T RENAME TO T_r2105;
INSERT INTO t1 DEFAULT VALUES;
CREATE  INDEX IF NOT EXISTS idx_t4_4658 ON t4(d) WHERE d > 0;
PRAGMA count_changes = ON;
UPDATE t2 SET b = json_object('k', b);
UPDATE t3 SET c = CURRENT_TIMESTAMP WHERE rowid = 1;
INSERT OR REPLACE INTO t2 VALUES (NULL);
VACUUM;
SELECT LEAD(a, 1) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;

INSERT INTO t3 VALUES (1) ON CONFLICT(c) DO UPDATE SET c = excluded.c;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6_2755 ON t6((e + 1)) WHERE e IS NOT NULL;
SELECT COUNT(c) FROM t3;
```

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

