## 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 trusted_schema;
.width -unhex('4') -2 -3
BEGIN DEFERRED;
.open
BEGIN DEFERRED;
.dump
SAVEPOINT sp688;
-- json_array({v})

.nullvalue x'8bfa8aa1306e3bcaaf92966e8ce19b'NULL2327d3-log2(soundex(5))36b-41de-a764-a6301986aeab
PRAGMA defer_foreign_keys;
CREATE TABLE "T" (
  a DOUB,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (pow(atan(1), 1),'a',3.14), (1,'b',-7.75), (2,'c',-9e999);
SELECT b,a,c,
RANK() OVER (PARTITION BY a ORDER BY c DESC) AS d FROM T;
ATTACH DATABASE ':memory:' AS aux77;
ATTACH DATABASE ':memory:' AS aux50;
PRAGMA module_list;
.exit -(jsonb_each(json_each(x'4452f1f3ff4b'), '$.arr') + CAST(1 AS FLOAT))
PRAGMA table_info(users);
PRAGMA short_column_names IS NOT ON;
PRAGMA user_version = '''''';
.print https://yewtu.be/watch?v=dQw4w9WgXcQ
CREATE TABLE `T` (
  A VARCHAR(20),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM	T GROUP BY B ORDER BY D DESC, B ASC;
SELECT * FROM T AS a INNER JOIN T AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE NOT A > (SELECT AVG(A) FROM T);

UPDATE T SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
ALTER TABLE T RENAME COLUMN A TO A_r6693;
DELETE FROM T WHERE 0 RETURNING *;
SELECT COUNT(*) FROM T;
VACUUM main;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<0) SELECT * FROM cnt;
WITH RECURSIVE self(x) AS (SELECT 1 UNION ALL SELECT x FROM self) SELECT * FROM self LIMIT 5;
INSERT INTO T DEFAULT VALUES;
REINDEX T;
SELECT GROUP_CONCAT(B, '|') FROM T;
DELETE FROM T WHERE 0 RETURNING *;
SELECT * FROM T;
SELECT * FROM T WHERE B IN (SELECT B FROM T WHERE B LIKE "%%");
ALTER TABLE T RENAME TO T_r8238;

SELECT COUNT(*) FROM T;
PRAGMA trusted_schema = NO;
ALTER TABLE T DROP COLUMN B;
SELECT * FROM T AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T (
  a NATIVE CHARACTER(70)NVARCHAR(100),
  b TEXT
);
INSERT INTO T VALUES ('a','2020-01-01'), ('b','2026-01-01');
SELECT a,
CAST(
  (julianday('now')-julianday(b))/365.25
  AS INTEGER
) AS c
FROM T;
DETACH DATABASE aux50;
DETACH DATABASE aux77;
SELECT * FROM T CROSS JOIN T;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T VALUES (NULL, NULL);
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_9728 AS SELECT b FROM T;
CREATE TABLE T (
  a TEXT,
  b TEXT
);
INSERT INTO T VALUES ('a','2020-01-01'), ('b','2026-01-01');
SELECT a,
CAST(
  (julianday('now')-julianday(b))/365.25
  AS INTEGER
) AS c
FROM T;
CREATE  VIEW IF NOT EXISTS v_T_1441 AS SELECT b FROM T;
ANALYZE T;
ALTER TABLE T DROP COLUMN b;

SELECT COUNT(*) FROM T;
SELECT * FROM T WHERE /**/ b > (SELECT COUNT(*) FROM T);
INSERT INTO T DEFAULT VALUES;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T t2 WHERE t2.a = T.a);
SELECT * FROM T WHERE a <= ANY (SELECT a FROM T);
SELECT * FROM T WHERE a <= ALL (SELECT a FROM T);
DROP TRIGGER IF EXISTS T;
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;
CREATE  INDEX IF NOT EXISTS idx_T_6057 ON T((b + 1));
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a, 1) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM T;
RELEASE sp688;
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;
INSERT INTO T DEFAULT VALUES;
SELECT * FROM T WHERE b < (SELECT AVG(b) FROM T);
SELECT MIN(b) FROM T;
ALTER TABLE T RENAME TO T_r8142;
SELECT STRING_AGG(a) FROM T;

COMMIT TRANSACTION;
INSERT OR IGNORE INTO T VALUES ('', NULL);
SELECT NTILE(1) OVER (ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
INSERT INTO T VALUES (NULL, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b;
ANALYZE;
ALTER TABLE T DROP COLUMN b;
ALTER TABLE T RENAME COLUMN a TO a_r5366;
CREATE TRIGGER IF NOT EXISTS trg_T_3151 BEFORE DELETE ON T FOR EACH ROW BEGIN INSERT INTO T(b) VALUES (NULL); END;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
ALTER TABLE T RENAME COLUMN b TO b_r2313;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
.open
BEGIN DEFERRED;
.dump
SAVEPOINT sp688;
-- json_array({v})

.nullvalue x'8bfa8aa1306e3bcaaf92966e8ce19b'NULL2327d3-log2(soundex(5))36b-41de-a764-a6301986aeab
PRAGMA defer_foreign_keys;
CREATE TABLE "T" (
  a DOUB,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (pow(atan(1), 1),'a',3.14), (1,'b',-7.75), (2,'c',-9e999);
SELECT b,a,c,
RANK() OVER (PARTITION BY a ORDER BY c DESC) AS d FROM T;
ATTACH DATABASE ':memory:' AS aux77;
ATTACH DATABASE ':memory:' AS aux50;
PRAGMA module_list;
.exit -(jsonb_each(json_each(x'4452f1f3ff4b'), '$.arr') + CAST(1 AS FLOAT))
PRAGMA table_info(users);
PRAGMA short_column_names IS NOT ON;
PRAGMA user_version = '''''';
.print https://yewtu.be/watch?v=dQw4w9WgXcQ
CREATE TABLE `T` (
  A VARCHAR(20),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM	T GROUP BY B ORDER BY D DESC, B ASC;
SELECT * FROM T AS a INNER JOIN T AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE NOT A > (SELECT AVG(A) FROM T);

UPDATE T SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
ALTER TABLE T RENAME COLUMN A TO A_r6693;
DELETE FROM T WHERE 0 RETURNING *;
SELECT COUNT(*) FROM T;
VACUUM main;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<0) SELECT * FROM cnt;
WITH RECURSIVE self(x) AS (SELECT 1 UNION ALL SELECT x FROM self) SELECT * FROM self LIMIT 5;
INSERT INTO T DEFAULT VALUES;
REINDEX T;
SELECT GROUP_CONCAT(B, '|') FROM T;
DELETE FROM T WHERE 0 RETURNING *;
SELECT * FROM T;
SELECT * FROM T WHERE B IN (SELECT B FROM T WHERE B LIKE "%%");
ALTER TABLE T RENAME TO T_r8238;

SELECT COUNT(*) FROM T;
PRAGMA trusted_schema = NO;
ALTER TABLE T DROP COLUMN B;
SELECT * FROM T AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T (
  a NATIVE CHARACTER(70)NVARCHAR(100),
  b TEXT
);
INSERT INTO T VALUES ('a','2020-01-01'), ('b','2026-01-01');
SELECT a,
CAST(
  (julianday('now')-julianday(b))/365.25
  AS INTEGER
) AS c
FROM T;
DETACH DATABASE aux50;
DETACH DATABASE aux77;
SELECT * FROM T CROSS JOIN T;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T VALUES (NULL, NULL);
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_9728 AS SELECT b FROM T;
CREATE TABLE T (
  a TEXT,
  b TEXT
);
INSERT INTO T VALUES ('a','2020-01-01'), ('b','2026-01-01');
SELECT a,
CAST(
  (julianday('now')-julianday(b))/365.25
  AS INTEGER
) AS c
FROM T;
CREATE  VIEW IF NOT EXISTS v_T_1441 AS SELECT b FROM T;
ANALYZE T;
ALTER TABLE T DROP COLUMN b;

SELECT COUNT(*) FROM T;
SELECT * FROM T WHERE /**/ b > (SELECT COUNT(*) FROM T);
INSERT INTO T DEFAULT VALUES;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T t2 WHERE t2.a = T.a);
SELECT * FROM T WHERE a <= ANY (SELECT a FROM T);
SELECT * FROM T WHERE a <= ALL (SELECT a FROM T);
DROP TRIGGER IF EXISTS T;
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;
CREATE  INDEX IF NOT EXISTS idx_T_6057 ON T((b + 1));
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a, 1) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM T;
RELEASE sp688;
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;
INSERT INTO T DEFAULT VALUES;
SELECT * FROM T WHERE b < (SELECT AVG(b) FROM T);
SELECT MIN(b) FROM T;
ALTER TABLE T RENAME TO T_r8142;
SELECT STRING_AGG(a) FROM T;

COMMIT TRANSACTION;
INSERT OR IGNORE INTO T VALUES ('', NULL);
SELECT NTILE(1) OVER (ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
INSERT INTO T VALUES (NULL, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b;
ANALYZE;
ALTER TABLE T DROP COLUMN b;
ALTER TABLE T RENAME COLUMN a TO a_r5366;
CREATE TRIGGER IF NOT EXISTS trg_T_3151 BEFORE DELETE ON T FOR EACH ROW BEGIN INSERT INTO T(b) VALUES (NULL); END;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
ALTER TABLE T RENAME COLUMN b TO b_r2313;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
.open
BEGIN DEFERRED;
.dump
SAVEPOINT sp688;
-- json_array({v})

.nullvalue x'8bfa8aa1306e3bcaaf92966e8ce19b'NULL2327d3-log2(soundex(5))36b-41de-a764-a6301986aeab
PRAGMA defer_foreign_keys;
CREATE TABLE "T" (
  a DOUB,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (pow(atan(1), 1),'a',3.14), (1,'b',-7.75), (2,'c',-9e999);
SELECT b,a,c,
RANK() OVER (PARTITION BY a ORDER BY c DESC) AS d FROM T;
ATTACH DATABASE ':memory:' AS aux77;
ATTACH DATABASE ':memory:' AS aux50;
PRAGMA module_list;
.exit -(jsonb_each(json_each(x'4452f1f3ff4b'), '$.arr') + CAST(1 AS FLOAT))
PRAGMA table_info(users);
PRAGMA short_column_names IS NOT ON;
PRAGMA user_version = '''''';
.print https://yewtu.be/watch?v=dQw4w9WgXcQ
CREATE TABLE `T` (
  A VARCHAR(20),
  B VARCHAR(10),
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p');
INSERT INTO T VALUES ('a', 'q');
INSERT INTO T VALUES ('b', 'q');
INSERT INTO T VALUES ('c', 'r');
INSERT INTO T VALUES ('b', 'r');
INSERT INTO T VALUES ('b', 't');
SELECT B, COUNT(DISTINCT A) AS D FROM	T GROUP BY B ORDER BY D DESC, B ASC;
SELECT * FROM T AS a INNER JOIN T AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE NOT A > (SELECT AVG(A) FROM T);

UPDATE T SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
ALTER TABLE T RENAME COLUMN A TO A_r6693;
DELETE FROM T WHERE 0 RETURNING *;
SELECT COUNT(*) FROM T;
VACUUM main;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<0) SELECT * FROM cnt;
WITH RECURSIVE self(x) AS (SELECT 1 UNION ALL SELECT x FROM self) SELECT * FROM self LIMIT 5;
INSERT INTO T DEFAULT VALUES;
REINDEX T;
SELECT GROUP_CONCAT(B, '|') FROM T;
DELETE FROM T WHERE 0 RETURNING *;
SELECT * FROM T;
SELECT * FROM T WHERE B IN (SELECT B FROM T WHERE B LIKE "%%");
ALTER TABLE T RENAME TO T_r8238;

SELECT COUNT(*) FROM T;
PRAGMA trusted_schema = NO;
ALTER TABLE T DROP COLUMN B;
SELECT * FROM T AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T (
  a NATIVE CHARACTER(70)NVARCHAR(100),
  b TEXT
);
INSERT INTO T VALUES ('a','2020-01-01'), ('b','2026-01-01');
SELECT a,
CAST(
  (julianday('now')-julianday(b))/365.25
  AS INTEGER
) AS c
FROM T;
DETACH DATABASE aux50;
DETACH DATABASE aux77;
SELECT * FROM T CROSS JOIN T;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T VALUES (NULL, NULL);
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_9728 AS SELECT b FROM T;
CREATE TABLE T (
  a TEXT,
  b TEXT
);
INSERT INTO T VALUES ('a','2020-01-01'), ('b','2026-01-01');
SELECT a,
CAST(
  (julianday('now')-julianday(b))/365.25
  AS INTEGER
) AS c
FROM T;
CREATE  VIEW IF NOT EXISTS v_T_1441 AS SELECT b FROM T;
ANALYZE T;
ALTER TABLE T DROP COLUMN b;

SELECT COUNT(*) FROM T;
SELECT * FROM T WHERE /**/ b > (SELECT COUNT(*) FROM T);
INSERT INTO T DEFAULT VALUES;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T t2 WHERE t2.a = T.a);
SELECT * FROM T WHERE a <= ANY (SELECT a FROM T);
SELECT * FROM T WHERE a <= ALL (SELECT a FROM T);
DROP TRIGGER IF EXISTS T;
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;
CREATE  INDEX IF NOT EXISTS idx_T_6057 ON T((b + 1));
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a, 1) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM T;
RELEASE sp688;
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;
INSERT INTO T DEFAULT VALUES;
SELECT * FROM T WHERE b < (SELECT AVG(b) FROM T);
SELECT MIN(b) FROM T;
ALTER TABLE T RENAME TO T_r8142;
SELECT STRING_AGG(a) FROM T;

COMMIT TRANSACTION;
INSERT OR IGNORE INTO T VALUES ('', NULL);
SELECT NTILE(1) OVER (ORDER BY b ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
INSERT INTO T VALUES (NULL, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b;
ANALYZE;
ALTER TABLE T DROP COLUMN b;
ALTER TABLE T RENAME COLUMN a TO a_r5366;
CREATE TRIGGER IF NOT EXISTS trg_T_3151 BEFORE DELETE ON T FOR EACH ROW BEGIN INSERT INTO T(b) VALUES (NULL); END;
SELECT LEAD(a, 1, NULL) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
ALTER TABLE T RENAME COLUMN b TO b_r2313;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;

SELECT LAG(a, 2, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
INSERT INTO T VALUES (NULL, NULL);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T_3102 ON T((b + 1));
ROLLBACK;
PRAGMA locking_mode;
INSERT INTO T DEFAULT VALUES;
ALTER TABLE T ADD COLUMN extra_1580 DATETIME NOT NULL DEFAULT 0;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_7601 AS SELECT b FROM T;
CREATE TRIGGER IF NOT EXISTS trg_T_3285 AFTER DELETE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
INSERT INTO T DEFAULT VALUES;
CREATE  VIEW IF NOT EXISTS v_T_243 AS SELECT b FROM T;

SELECT COUNT(*) FROM T;
```

## Actual output

```sql
1
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
COMMIT;
0
a|0.785398163397448|3.14|1
b|1.0|-7.75|1
c|2.0|-Inf|1
sqlite_dbdata
generate_series
completion
fsdir
tables_used
sqlite_stmt
json_tree
fts4aux
fts3
fts4
sqlite_dbptr
fts3tokenize
bytecode
rtree_i32
sqlite_dbpage
rtree
dbstat
json_each
```

## Expectation

```sql
0
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
COMMIT;
0
a|0.785398163397448|3.14|1
b|1.0|-7.75|1
c|2.0|-Inf|1
fsdir
generate_series
bytecode
dbstat
tables_used
sqlite_stmt
sqlite_dbpage
rtree_i32
fts4aux
fts3
zipfile
fts4
completion
rtree
fts3tokenize
```

## Flag

```

```

