## 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
.read
BEGIN EXCLUSIVE;
CREATE TABLE T1 (
  A VARCHAR(-log10(unicode(123))) PRIMARY KEY,
  B VARCHAR(30) NOT NULL UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(10) PRIMARY KEY,
  X VARCHAR(15) NOT NULL,
  C BIGINT,
  FOREIGN KEY (X) REFERENCES T1(A)
);
INSERT INTO T1 VALUES (('p' || ''), 'x');
INSERT INTO T1 VALUES ('q', 'y');
INSERT INTO T2 VALUES ('a', 'p', 9223372036854775807);
INSERT INTO T2 VALUES ('b', 'q', -9223372036854775808);
SELECT X, SUM(C) AS D, COUNT(*) AS E FROM T2 GROUP BY X;
PRAGMA quick_check(20);
PRAGMA read_uncommitted != TRUE;
CREATE TABLE T (
  a VARCHAR(255),
  b REAL
);
INSERT INTO T VALUES (1,1.5), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b >= -2.5 AND b < 2.0;
.check
PRAGMA short_column_names == NO;
PRAGMA integrity_check;
PRAGMA ignore_check_constraints = -(0 + 1.0);
.trace
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('' || ('a'),'b',1.0), ('a','c',-1.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;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T RENAME COLUMN a TO a_r2854;
ALTER TABLE T RENAME COLUMN b TO b_r6360;
SELECT MIN(b) FROM T;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T ADD COLUMN extra_5537 DOUBLE PRECISION;
ALTER TABLE T RENAME TO T_r6675;
ANALYZE;
ALTER TABLE T RENAME COLUMN c TO c_r7302;
SELECT * FROM T AS a JOIN T AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE 1 RETURNING *;
SELECT NTILE(1) OVER (PARTITION BY c ORDER BY c) FROM T;
VACUUM main;
PRAGMA cache_spill = 0;
CREATE TABLE T (
  a TEXT,
  b TEXT
);
INSERT INTO T VALUES ('a','b'), ('c','d');
SELECT * FROM T WHERE a = REPLACE('a;',';','') AND b = 'b';
INSERT INTO T VALUES (NULL, NULL);
SELECT * FROM (SELECT * FROM T ORDER BY a) AS sub LIMIT 10;
INSERT INTO T SELECT * FROM T;
CREATE  INDEX IF NOT EXISTS idx_T_6056 ON T(a COLLATE NOCASE);
INSERT INTO T SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE b IN (SELECT x FROM cte);
ALTER TABLE T ADD COLUMN extra_9222 TINYINT NOT NULL DEFAULT 0;
INSERT INTO T DEFAULT VALUES;
VACUUM;
INSERT INTO T SELECT * FROM T;
SELECT GROUP_CONCAT(b) FROM T;
ALTER TABLE T DROP COLUMN a;
SELECT * FROM T1;
DROP VIEW IF EXISTS T;
UPDATE T1 SET A = NULL WHERE 1;
ALTER TABLE T1 RENAME TO T1_r4440;
SELECT * FROM T1 WHERE B < ANY (SELECT B FROM T1);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T2_6998 ON T2(X COLLATE NOCASE) WHERE X > 0;
INSERT OR IGNORE INTO T2 VALUES ('x', '', '');
ANALYZE T;
CREATE TABLE T1 (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(10) PRIMARY KEY,
  X VARCHAR(15) NOT NULL,
  C BIGINT,
  FOREIGN KEY (X) REFERENCES T1(A)
);
INSERT INTO T1 VALUES (('p' || ''), 'x');
INSERT INTO T1 VALUES ('q', 'y');
INSERT INTO T2 VALUES ('a', 'p', 9223372036854775807);
INSERT INTO T2 VALUES ('b', 'q', -9223372036854775808);
SELECT X, SUM(C) AS D, COUNT(*) AS E FROM T2 GROUP BY X;
PRAGMA quick_check(20);
PRAGMA read_uncommitted = TRUE;
CREATE TABLE T (
  a VARCHAR(255),
  b REAL
);
INSERT INTO T VALUES (1,1.5), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b >= -2.5 AND b < 2.0;
.check
PRAGMA short_column_names == NO;
PRAGMA integrity_check;
PRAGMA ignore_check_constraints = -(0 + 1.0);
.trace
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('' || ('a'),'b',1.0), ('a','c',-1.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;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T RENAME COLUMN a TO a_r2854;
ALTER TABLE T RENAME COLUMN b TO b_r6360;
SELECT MIN(b) FROM T;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T ADD COLUMN extra_5537 DOUBLE PRECISION;
ALTER TABLE T RENAME TO T_r6675;
ANALYZE;
ALTER TABLE T RENAME COLUMN c TO c_r7302;
SELECT * FROM T AS a JOIN T AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE 1 RETURNING *;
SELECT NTILE(1) OVER (PARTITION BY c ORDER BY c) FROM T;
VACUUM main;
PRAGMA cache_spill = 0;
CREATE TABLE T (
  a TEXT,
  b TEXT
);
INSERT INTO T VALUES ('a','b'), ('c','d');
SELECT * FROM T WHERE a = REPLACE('a;',';','') AND b = 'b';
INSERT INTO T VALUES (NULL, NULL);
SELECT * FROM (SELECT * FROM T ORDER BY a) AS sub LIMIT 10;
INSERT INTO T SELECT * FROM T;
CREATE  INDEX IF NOT EXISTS idx_T_6056 ON T(a COLLATE NOCASE);
INSERT INTO T SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE b IN (SELECT x FROM cte);
ALTER TABLE T ADD COLUMN extra_9222 TINYINT NOT NULL DEFAULT 0;
INSERT INTO T DEFAULT VALUES;
VACUUM;
INSERT INTO T SELECT * FROM T;
SELECT GROUP_CONCAT(b) FROM T;
ALTER TABLE T DROP COLUMN a;
SELECT * FROM T1;
DROP VIEW IF EXISTS T;
UPDATE T1 SET A = NULL WHERE 1;
ALTER TABLE T1 RENAME TO T1_r4440;
SELECT * FROM T1 WHERE B < ANY (SELECT B FROM T1);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T2_6998 ON T2(X COLLATE NOCASE) WHERE X > 0;
INSERT OR IGNORE INTO T2 VALUES ('x', '', '');
ANALYZE T;
CREATE TABLE T1 (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(10) PRIMARY KEY,
  X VARCHAR(15) NOT NULL,
  C BIGINT,
  FOREIGN KEY (X) REFERENCES T1(A)
);
INSERT INTO T1 VALUES (('p' || ''), 'x');
INSERT INTO T1 VALUES ('q', 'y');
INSERT INTO T2 VALUES ('a', 'p', 9223372036854775807);
INSERT INTO T2 VALUES ('b', 'q', -9223372036854775808);
SELECT X, SUM(C) AS D, COUNT(*) AS E FROM T2 GROUP BY X;
PRAGMA quick_check(20);
PRAGMA read_uncommitted = TRUE;
CREATE TABLE T (
  a VARCHAR(255),
  b REAL
);
INSERT INTO T VALUES (1,1.5), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b >= -2.5 AND b < 2.0;
.check
PRAGMA short_column_names == NO;
PRAGMA integrity_check;
PRAGMA ignore_check_constraints = -(0 + 1.0);
.trace
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('' || ('a'),'b',1.0), ('a','c',-1.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;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T RENAME COLUMN a TO a_r2854;
ALTER TABLE T RENAME COLUMN b TO b_r6360;
SELECT MIN(b) FROM T;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T ADD COLUMN extra_5537 DOUBLE PRECISION;
ALTER TABLE T RENAME TO T_r6675;
ANALYZE;
ALTER TABLE T RENAME COLUMN c TO c_r7302;
SELECT * FROM T AS a JOIN T AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE 1 RETURNING *;
SELECT NTILE(1) OVER (PARTITION BY c ORDER BY c) FROM T;
VACUUM main;
PRAGMA cache_spill = 0;
CREATE TABLE T (
  a TEXT,
  b TEXT
);
INSERT INTO T VALUES ('a','b'), ('c','d');
SELECT * FROM T WHERE a = REPLACE('a;',';','') AND b = 'b';
INSERT INTO T VALUES (NULL, NULL);
SELECT * FROM (SELECT * FROM T ORDER BY a) AS sub LIMIT 10;
INSERT INTO T SELECT * FROM T;
CREATE  INDEX IF NOT EXISTS idx_T_6056 ON T(a COLLATE NOCASE);
INSERT INTO T SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE b IN (SELECT x FROM cte);
ALTER TABLE T ADD COLUMN extra_9222 TINYINT NOT NULL DEFAULT 0;
INSERT INTO T DEFAULT VALUES;
VACUUM;
INSERT INTO T SELECT * FROM T;
SELECT GROUP_CONCAT(b) FROM T;
ALTER TABLE T DROP COLUMN a;
SELECT * FROM T1;
DROP VIEW IF EXISTS T;
UPDATE T1 SET A = NULL WHERE 1;
ALTER TABLE T1 RENAME TO T1_r4440;
SELECT * FROM T1 WHERE B < ANY (SELECT B FROM T1);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T2_6998 ON T2(X COLLATE NOCASE) WHERE X > 0;
INSERT OR IGNORE INTO T2 VALUES ('x', '', '');
ANALYZE T;
CREATE TABLE T1 (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(10) PRIMARY KEY,
  X VARCHAR(15) NOT NULL,
  C BIGINT,
  FOREIGN KEY (X) REFERENCES T1(A)
);
INSERT INTO T1 VALUES (('p' || ''), 'x');
INSERT INTO T1 VALUES ('q', 'y');
INSERT INTO T2 VALUES ('a', 'p', 9223372036854775807);
INSERT INTO T2 VALUES ('b', 'q', -9223372036854775808);
SELECT X, SUM(C) AS D, COUNT(*) AS E FROM T2 GROUP BY X;
PRAGMA quick_check(20);
PRAGMA read_uncommitted = TRUE;
CREATE TABLE T (
  a VARCHAR(255),
  b REAL
);
INSERT INTO T VALUES (1,1.5), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b >= -2.5 AND b < 2.0;
.check
PRAGMA short_column_names == NO;
PRAGMA integrity_check;
PRAGMA ignore_check_constraints = -(0 + 1.0);
.trace
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('' || ('a'),'b',1.0), ('a','c',-1.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;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T RENAME COLUMN a TO a_r2854;
ALTER TABLE T RENAME COLUMN b TO b_r6360;
SELECT MIN(b) FROM T;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T ADD COLUMN extra_5537 DOUBLE PRECISION;
ALTER TABLE T RENAME TO T_r6675;
ANALYZE;
ALTER TABLE T RENAME COLUMN c TO c_r7302;
SELECT * FROM T AS a JOIN T AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE 1 RETURNING *;
SELECT NTILE(1) OVER (PARTITION BY c ORDER BY c) FROM T;
VACUUM main;
PRAGMA cache_spill = 0;
CREATE TABLE T (
  a TEXT,
  b TEXT
);
INSERT INTO T VALUES ('a','b'), ('c','d');
SELECT * FROM T WHERE a = REPLACE('a;',';','') AND b = 'b';
INSERT INTO T VALUES (NULL, NULL);
SELECT * FROM (SELECT * FROM T ORDER BY a) AS sub LIMIT 10;
INSERT INTO T SELECT * FROM T;
CREATE  INDEX IF NOT EXISTS idx_T_6056 ON T(a COLLATE NOCASE);
INSERT INTO T SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE b IN (SELECT x FROM cte);
ALTER TABLE T ADD COLUMN extra_9222 TINYINT NOT NULL DEFAULT 0;
INSERT INTO T DEFAULT VALUES;
VACUUM;
INSERT INTO T SELECT * FROM T;
SELECT GROUP_CONCAT(b) FROM T;
ALTER TABLE T DROP COLUMN a;
SELECT * FROM T1;
DROP VIEW IF EXISTS T;
UPDATE T1 SET A = NULL WHERE 1;
ALTER TABLE T1 RENAME TO T1_r4440;
SELECT * FROM T1 WHERE B < ANY (SELECT B FROM T1);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T2_6998 ON T2(X COLLATE NOCASE) WHERE X > 0;
INSERT OR IGNORE INTO T2 VALUES ('x', '', '');
ANALYZE T;
CREATE TABLE T1 (
  A VARCHAR(15) PRIMARY KEY,
  B VARCHAR(30) NOT NULL UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(10) PRIMARY KEY,
  X VARCHAR(15) NOT NULL,
  C BIGINT,
  FOREIGN KEY (X) REFERENCES T1(A)
);
INSERT INTO T1 VALUES (('p' || ''), 'x');
INSERT INTO T1 VALUES ('q', 'y');
INSERT INTO T2 VALUES ('a', 'p', 9223372036854775807);
INSERT INTO T2 VALUES ('b', 'q', -9223372036854775808);
SELECT X, SUM(C) AS D, COUNT(*) AS E FROM T2 GROUP BY X;
PRAGMA quick_check(20);
PRAGMA read_uncommitted = TRUE;
CREATE TABLE T (
  a VARCHAR(255),
  b REAL
);
INSERT INTO T VALUES (1,1.5), (2,-2.5), (3,0.0);
CREATE INDEX c
ON T(b);
SELECT * FROM T WHERE b >= -2.5 AND b < 2.0;
.check
PRAGMA short_column_names == NO;
PRAGMA integrity_check;
PRAGMA ignore_check_constraints = -(0 + 1.0);
.trace
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('' || ('a'),'b',1.0), ('a','c',-1.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;
INSERT INTO T DEFAULT VALUES;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T RENAME COLUMN a TO a_r2854;
ALTER TABLE T RENAME COLUMN b TO b_r6360;
SELECT MIN(b) FROM T;
INSERT INTO T VALUES (NULL, NULL, NULL);
ALTER TABLE T ADD COLUMN extra_5537 DOUBLE PRECISION;
ALTER TABLE T RENAME TO T_r6675;
ANALYZE;
ALTER TABLE T RENAME COLUMN c TO c_r7302;
SELECT * FROM T AS a JOIN T AS b ON a.rowid = b.rowid;
DELETE FROM T WHERE 1 RETURNING *;
SELECT NTILE(1) OVER (PARTITION BY c ORDER BY c) FROM T;
VACUUM main;
PRAGMA cache_spill = 0;
CREATE TABLE T (
  a TEXT,
  b TEXT
);
INSERT INTO T VALUES ('a','b'), ('c','d');
SELECT * FROM T WHERE a = REPLACE('a;',';','') AND b = 'b';
INSERT INTO T VALUES (NULL, NULL);
SELECT * FROM (SELECT * FROM T ORDER BY a) AS sub LIMIT 10;
INSERT INTO T SELECT * FROM T;
CREATE  INDEX IF NOT EXISTS idx_T_6056 ON T(a COLLATE NOCASE);
INSERT INTO T SELECT * FROM T;
WITH cte(x) AS (VALUES(1),(2),(3)) SELECT * FROM T WHERE b IN (SELECT x FROM cte);
ALTER TABLE T ADD COLUMN extra_9222 TINYINT NOT NULL DEFAULT 0;
INSERT INTO T DEFAULT VALUES;
VACUUM;
INSERT INTO T SELECT * FROM T;
SELECT GROUP_CONCAT(b) FROM T;
ALTER TABLE T DROP COLUMN a;
SELECT * FROM T1;
DROP VIEW IF EXISTS T;
UPDATE T1 SET A = NULL WHERE 1;
ALTER TABLE T1 RENAME TO T1_r4440;
SELECT * FROM T1 WHERE B < ANY (SELECT B FROM T1);
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T2_6998 ON T2(X COLLATE NOCASE) WHERE X > 0;
INSERT OR IGNORE INTO T2 VALUES ('x', '', '');
ANALYZE T;

DROP VIEW IF EXISTS T1;
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;

SELECT COUNT(*) FROM T1;
COMMIT;
SELECT * FROM T1 CROSS JOIN T1;
SELECT * FROM T1 AS a LEFT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
WITH cte AS (SELECT NULL AS x) SELECT COALESCE(x, 0) FROM cte;
```

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

