## 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 aux31;
PRAGMA integrity_check("users");
ATTACH DATABASE ':memory:' AS aux42;
-- PRAGMA locking_mode = 'EXCLUSIVE';

.explain auto
PRAGMA recursive_triggers > OFF;
PRAGMA empty_result_callbacks;
PRAGMA checkpoint_fullsync = YES;
.bail on
CREATE TABLE T (
  A VARCHAR(-(-(20))),
  B VARCHAR(10),
  C INTEGER,
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p', -2147483648);
INSERT INTO T VALUES ('b', 'q', 100);
INSERT INTO T VALUES ('b', 'r', 200);
INSERT INTO T VALUES ('c', 's', 300);
INSERT INTO T VALUES ('d', 't', 2147483647);
INSERT INTO T VALUES ('b', 't', 50);
SELECT A, COUNT(*) AS D, SUM(C) AS E FROM T GROUP BY A HAVING COUNT(*) > 1;
DETACH DATABASE aux42;
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;
DELETE FROM T WHERE B > (SELECT AVG(B) FROM T);
REINDEX T;
WITH cte AS (SELECT A FROM T UNION ALL SELECT A FROM T) SELECT * FROM cte;
DETACH DATABASE aux31;
ATTACH DATABASE ':memory:' AS aux31;
PRAGMA integrity_check("users");
ATTACH DATABASE ':memory:' AS aux42;
-- PRAGMA locking_mode = 'EXCLUSIVE';

.explain auto
PRAGMA recursive_triggers = OFF;
PRAGMA empty_result_callbacks;
PRAGMA checkpoint_fullsync = YES;
.bail on
CREATE TABLE T (
  A VARCHAR(20),
  B VARCHAR(10),
  C INTEGER,
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p', -2147483648);
INSERT INTO T VALUES ('b', 'q', 100);
INSERT INTO T VALUES ('b', 'r', 200);
INSERT INTO T VALUES ('c', 's', 300);
INSERT INTO T VALUES ('d', 't', 2147483647);
INSERT INTO T VALUES ('b', 't', 50);
SELECT A, COUNT(*) AS D, SUM(C) AS E FROM T GROUP BY A HAVING COUNT(*) > 1;
DETACH DATABASE aux42;
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;
DELETE FROM T WHERE B > (SELECT AVG(B) FROM T);
REINDEX T;
WITH cte AS (SELECT A FROM T UNION ALL SELECT A FROM T) SELECT * FROM cte;
DETACH DATABASE aux31;
ATTACH DATABASE ':memory:' AS aux31;
PRAGMA integrity_check("users");
ATTACH DATABASE ':memory:' AS aux42;
-- PRAGMA locking_mode = 'EXCLUSIVE';

.explain auto
PRAGMA recursive_triggers = OFF;
PRAGMA empty_result_callbacks;
PRAGMA checkpoint_fullsync = YES;
.bail on
CREATE TABLE T (
  A VARCHAR(20),
  B VARCHAR(10),
  C INTEGER,
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p', -2147483648);
INSERT INTO T VALUES ('b', 'q', 100);
INSERT INTO T VALUES ('b', 'r', 200);
INSERT INTO T VALUES ('c', 's', 300);
INSERT INTO T VALUES ('d', 't', 2147483647);
INSERT INTO T VALUES ('b', 't', 50);
SELECT A, COUNT(*) AS D, SUM(C) AS E FROM T GROUP BY A HAVING COUNT(*) > 1;
DETACH DATABASE aux42;
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;
DELETE FROM T WHERE B > (SELECT AVG(B) FROM T);
REINDEX T;
WITH cte AS (SELECT A FROM T UNION ALL SELECT A FROM T) SELECT * FROM cte;
DETACH DATABASE aux31;
ATTACH DATABASE ':memory:' AS aux31;
PRAGMA integrity_check("users");
ATTACH DATABASE ':memory:' AS aux42;
-- PRAGMA locking_mode = 'EXCLUSIVE';

.explain auto
PRAGMA recursive_triggers = OFF;
PRAGMA empty_result_callbacks;
PRAGMA checkpoint_fullsync = YES;
.bail on
CREATE TABLE T (
  A VARCHAR(20),
  B VARCHAR(10),
  C INTEGER,
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p', -2147483648);
INSERT INTO T VALUES ('b', 'q', 100);
INSERT INTO T VALUES ('b', 'r', 200);
INSERT INTO T VALUES ('c', 's', 300);
INSERT INTO T VALUES ('d', 't', 2147483647);
INSERT INTO T VALUES ('b', 't', 50);
SELECT A, COUNT(*) AS D, SUM(C) AS E FROM T GROUP BY A HAVING COUNT(*) > 1;
DETACH DATABASE aux42;
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;
DELETE FROM T WHERE B > (SELECT AVG(B) FROM T);
REINDEX T;
WITH cte AS (SELECT A FROM T UNION ALL SELECT A FROM T) SELECT * FROM cte;
DETACH DATABASE aux31;
ATTACH DATABASE ':memory:' AS aux31;
PRAGMA integrity_check("users");
ATTACH DATABASE ':memory:' AS aux42;
-- PRAGMA locking_mode = 'EXCLUSIVE';

.explain auto
PRAGMA recursive_triggers = OFF;
PRAGMA empty_result_callbacks;
PRAGMA checkpoint_fullsync = YES;
.bail on
CREATE TABLE T (
  A VARCHAR(20),
  B VARCHAR(10),
  C INTEGER,
  PRIMARY KEY (A, B)
);
INSERT INTO T VALUES ('a', 'p', -2147483648);
INSERT INTO T VALUES ('b', 'q', 100);
INSERT INTO T VALUES ('b', 'r', 200);
INSERT INTO T VALUES ('c', 's', 300);
INSERT INTO T VALUES ('d', 't', 2147483647);
INSERT INTO T VALUES ('b', 't', 50);
SELECT A, COUNT(*) AS D, SUM(C) AS E FROM T GROUP BY A HAVING COUNT(*) > 1;
DETACH DATABASE aux42;
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;
DELETE FROM T WHERE B > (SELECT AVG(B) FROM T);
REINDEX T;
WITH cte AS (SELECT A FROM T UNION ALL SELECT A FROM T) SELECT * FROM cte;
DETACH DATABASE aux31;

ALTER TABLE T ADD COLUMN extra_7151 SMALLINT UNIQUE;

SELECT COUNT(*) FROM T;
WITH RECURSIVE empty(x) AS (SELECT 1 WHERE 1=0 UNION ALL SELECT x+1 FROM empty WHERE x<10) SELECT * FROM empty;
SELECT * FROM T AS a LEFT JOIN T AS b ON a.rowid = b.rowid;
```

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

