## 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
ATTACH DATABASE ':memory:' AS aux68;
ATTACH DATABASE (':memory:' || '') AS aux79;
ATTACH DATABASE ':memory:' AS aux40;
.recover
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INseRt INTO T VALUES ('a','b',instr(NULL, tan(CAST('%' AS SMALLINT)))), ('a','c',-(CAST(unhex(trim(NULL, 'x'), ' ') AS CHARACTER(CAST(20 AS NATIVE CHARACTER(70)NVARCHAR(100)))) + 0.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;
.echo on
.stats stmt
PRAGMA optimize;
PRAGMA journal_mode = 'MEMORY';
BEGIN EXCLUSIVE;
SAVEPOINT sp8818;
SAVEPOINT sp9957;
.exit -(pi() + acos(('true' + 0).7976931348623157e+308))
CREATE VIRTUAL TABLE t0 USING fts4("x", "y", "z");
CREATE TABLE T (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) NOT NULL,
  C INTEGER,
  UNIQUE (B, C)
);
INSERT INTO T VALUES ('a', 'p', -2147483648);
INSERT INTO T VALUES ('b', 'q', 700);
INSERT INTO T VALUES ('c', 'r', 0);
INSERT INTO T VALUES ('d', 's', 2147483647);
INSERT INTO T VALUES ('e', 't', -1);
INSERT INTO T VALUES ('f', 'u', 1);
SELECT * FROM T WHERE NOT NOT (NOT NOT (NOT C BETWEEN -1000 AND 1000)) ORDER BY C ASC;
DROP TABLE t0;
PRAGMA temp_store = '2';
PRAGMA fullsync = FALSE;
PRAGMA read_uncommitted = round(9223372036854775807);
.cd bugs
CREATE TABLE "customer" (id UNSIGNED BIG INT PRIMARY KEY);
CREATE TABLE apr (id INT PRIMARY KEY, apr REAL);
CREATE VIEW v1 AS SELECT c.id, i.apr FROM customer c LEFT JOIN apr i ON i.id=c.id;
CREATE VIEW v1rj AS SELECT c.id, i.apr FROM apr i RIGHT JOIN customer c ON i.id=c.id;
CREATE VIEW v2 AS SELECT c.id, v1.apr FROM customer c LEFT JOIN v1 ON v1.id=c.id;
CREATE VIEW v2rj AS SELECT c.id, v1.apr FROM v1 RIGHT JOIN customer c ON v1.id=c.id;
CREATE VIEW v2rjrj AS SELECT c.id, v1rj.apr FROM v1rj RIGHT JOIN customer c ON v1rj.id=c.id;
INSERT INTO customer (id) VALUES (1);
INSERT INTO apr (id, apr) VALUES (1, 12);
INSERT INTO customer (id) VALUES (2);
INSERT INTO apr (id, apr) VALUES (2, 12.01);
PRAGMA automatic_index=ON;
SELECT id, (apr / 100), typeof(apr) apr_type  FROM v1;
SELECT * FROM customer WHERE id IN (SELECT id FROM customer LIMIT 0);
SELECT * FROM (SELECT * FROM customer) AS sub;
SELECT * FROM apr WHERE EXISTS (SELECT 1 FROM apr WHERE EXISTS (SELECT 1 FROM apr));
CREATE TRIGGER IF NOT EXISTS trg_customer_998 AFTER DELETE ON customer BEGIN INSERT INTO customer(id) VALUES (NULL); END;
SELECT * FROM customer WHERE id <> ANY (SELECT id FROM customer);
SELECT * FROM apr WHERE EXISTS (SELECT 1 FROM apr t2 WHERE t2.id = apr.id);
INSERT OR REPLACE INTO customer VALUES (NULL);
SELECT COUNT(*) FILTER (WHERE apr IS NOT NULL), SUM(rowid) FILTER (WHERE apr > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(apr) FILTER (WHERE apr > 0 AND apr < 100), COUNT(*) FILTER (WHERE typeof(apr) = "text") FROM apr;
UPDATE customer SET id = 52 WHERE rowid = 1;
INSERT INTO apr DEFAULT VALUES;
UPDATE apr SET id = CURRENT_TIMESTAMP;
ROLLBACK TRANSACTION TO SAVEPOINT sp9957;
RELEASE SAVEPOINT sp9957;
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;
WITH cte AS (SELECT * FROM customer) SELECT * FROM cte;
INSERT INTO customer VALUES ('x') ON CONFLICT(id) DO UPDATE SET id = excluded.id;
SELECT * FROM customer;
SELECT STRING_AGG(id) FROM customer;
ROLLBACK TRANSACTION TO SAVEPOINT sp8818;
RELEASE SAVEPOINT sp8818;
SELECT COUNT(*) FILTER (WHERE apr IS NOT NULL), SUM(rowid) FILTER (WHERE apr > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(apr) FILTER (WHERE apr > 0 AND apr < 100), COUNT(*) FILTER (WHERE typeof(apr) = "text") FROM apr;
ANALYZE customer;
DELETE FROM customer WHERE rowid = 55 RETURNING *;
COMMIT;
INSERT INTO apr VALUES (NULL, NULL);
REINDEX;
INSERT INTO apr VALUES (NULL, NULL);
ANALYZE;
CREATE TABLE T (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) NOT NULL,
  C INTEGER,
  UNIQUE (B, C)
);
INSERT INTO T VALUES ('a', 'p', -2147483648);
INSERT INTO T VALUES ('b', 'q', 700);
INSERT INTO T VALUES ('c', 'r', 0);
INSERT INTO T VALUES ('d', 's', 2147483647);
INSERT INTO T VALUES ('e', 't', -1);
INSERT INTO T VALUES ('f', 'u', 1);
SELECT * FROM T WHERE C BETWEEN -1000 AND 1000 ORDER BY C ASC;
INSERT INTO apr VALUES (1, 'x') ON CONFLICT(id) DO UPDATE SET id = excluded.id, apr = excluded.apr;
INSERT INTO T DEFAULT VALUES;
WITH a AS (SELECT id FROM customer), b AS (SELECT COUNT(*) AS cnt FROM a) SELECT * FROM b;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T_651 ON T(A COLLATE NOCASE) WHERE A > 0;
ANALYZE;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_customer_2839 AS SELECT id FROM customer;
SELECT * FROM T CROSS JOIN customer;
SELECT * FROM apr;
INSERT OR FAIL INTO customer VALUES (NULL);
SELECT * FROM customer AS a FULL OUTER JOIN customer AS b ON a.rowid = b.rowid;
SELECT COUNT(*) FILTER (WHERE id IS NOT NULL), SUM(rowid) FILTER (WHERE id > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(id) FILTER (WHERE id > 0 AND id < 100), COUNT(*) FILTER (WHERE typeof(id) = "text") FROM apr;
SELECT * FROM customer;
ALTER TABLE apr ADD COLUMN extra_3754 ANY NOT NULL DEFAULT 0;
SELECT * FROM apr AS a JOIN customer AS b ON a.rowid = b.rowid;
ALTER TABLE T RENAME TO T_r1287;
CREATE  INDEX IF NOT EXISTS idx_T_8324 ON T(B COLLATE NOCASE) WHERE B > 0;
ANALYZE customer;
INSERT INTO T VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_customer_3825 BEFORE INSERT ON customer BEGIN SELECT RAISE(ABORT, 'abort'); END;
INSERT INTO customer VALUES (1) ON CONFLICT(id) DO UPDATE SET id = excluded.id;
SELECT * FROM customer AS a INNER JOIN T AS b ON a.rowid = b.rowid;
SELECT TOTAL(id) FROM customer;
SELECT * FROM T AS a LEFT OUTER JOIN apr AS b ON a.rowid = b.rowid;
ALTER TABLE T ADD COLUMN extra_1657 UNSIGNED BIG INT COLLATE RTRIM;
DROP TRIGGER IF EXISTS apr;
INSERT INTO customer DEFAULT VALUES;
SELECT COUNT(*) FILTER (WHERE apr IS NOT NULL), SUM(rowid) FILTER (WHERE apr > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(apr) FILTER (WHERE apr > 0 AND apr < 100), COUNT(*) FILTER (WHERE typeof(apr) = "text") FROM apr;
WITH RECURSIVE r AS (SELECT * FROM T LIMIT 1 UNION ALL SELECT t.* FROM T t JOIN r ON t.A = r.A LIMIT 10) SELECT * FROM r;
SELECT * FROM apr AS a FULL JOIN apr AS b ON a.rowid = b.rowid;
UPDATE apr SET id = id + 1 WHERE rowid = 1;
INSERT INTO apr VALUES (NULL, 'x') ON CONFLICT(id) DO UPDATE SET id = excluded.id, apr = excluded.apr;
DETACH DATABASE aux40;
SELECT NTILE(-1) OVER (PARTITION BY apr ORDER BY apr ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM apr;
ALTER TABLE T RENAME COLUMN C TO C_r4051;
VACUUM;
REINDEX apr;
INSERT OR ROLLBACK INTO apr VALUES ('', -2);

SELECT COUNT(*) FROM T;
REINDEX;
SELECT id, (SELECT MIN(id) FROM customer) AS min_val FROM customer;
PRAGMA vdbe_addoptrace = 0;
DETACH DATABASE aux79;
SELECT COUNT(*) FILTER (WHERE apr IS NOT NULL), SUM(rowid) FILTER (WHERE apr > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(apr) FILTER (WHERE apr > 0 AND apr < 100), COUNT(*) FILTER (WHERE typeof(apr) = "text") FROM apr;
CREATE TRIGGER IF NOT EXISTS trg_customer_4946 BEFORE INSERT ON customer FOR EACH ROW BEGIN INSERT INTO customer(id) VALUES (NULL); END;
ANALYZE;
PRAGMA legacy_alter_table = 0;
WITH cte(a, b) AS (VALUES(1, "a"),(2, "b"),(3, "c")) SELECT * FROM cte;
VACUUM main;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T_7883 ON T((A + 1)) WHERE A > 0;
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';
ALTER TABLE customer DROP COLUMN id;
UPDATE T SET B = 34 WHERE B IS NOT NULL RETURNING *;
DETACH DATABASE aux68;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<66) SELECT x FROM cnt WHERE x > 33;
```

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

