## 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
.expert
PRAGMA secure_delete = NO;
-- acosh({v})

.import random-json.db main
BEGIN DEFERRED;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote(('with''quote' || '')),trim('hello', NULL)),(julianday(sqlite_version()) -> '$[0]',x'bf547db2d53bde5a'),(json_patch(CAST('"' AS INT) ->> 'key', json_quote(CAST(json_extract(mod(datetime(1, '+1 day'), 1), '$.key') AS TEXT))),1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
CREATE TABLE main.T1 (
  a INTEGER,
  b REAL
);
CREATE TABLE T2 (
  a INTEGER,
  b REAL
);
INSERT INTO T1 VALUES (1,1.0);
INSERT INTO T2 VALUES (1,-1.0),(2,9e999);
INSERT AND REPLACE INTO T1
SELECT * FROM T2;
SELECT * FROM T1;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a LEFT JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out /* PRAGMA secure_delete = NO; */ AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6b_6440 ON t6b((y + 1)) WHERE NOT NOT NOT (NOT NOT (NOT NOT y > 0)) ;
SELECT MAX(a) FROM t5;
ANALYZE t6b;
SELECT SUM(b) FROM t5;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(sqlite_version()) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6b_6440 ON t6b((y + 1)) WHERE y > 0;
SELECT MAX(a) FROM t5;
ANALYZE t6b;
SELECT SUM(b) FROM t5;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(sqlite_version()) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES /* ÅÄÖËŸÏaáàưôốồỗổộơớờỡởợđ */ (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,1.5,10.0), (2,-2.5,20.0), (3,-9e999,30.0);
SELECT * FROM T WHERE b < 2.0 ORDER BY b;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6b_6440 ON t6b((y + 1)) WHERE y > 0;
SELECT MAX(a) FROM t5;
ANALYZE t6b;
SELECT SUM(b) FROM t5;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(sqlite_version()) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6b_6440 ON t6b((y + 1)) WHERE y > 0;
SELECT MAX(a) FROM t5;
ANALYZE t6b;
SELECT SUM(b) FROM t5;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(sqlite_version()) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP  TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6b_6440 ON t6b((y + 1)) WHERE y > 0;
SELECT MAX(a) FROM t5;
ANALYZE t6b;
SELECT SUM(b) FROM t5;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(sqlite_version()) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6b_6440 ON t6b((y + 1)) WHERE y > 0;
SELECT MAX(a) FROM t5;
ANALYZE t6b;
SELECT SUM(b) FROM t5;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(sqlite_version()) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
.exit
CREATE TABLE t5(a INT, b INT);
CREATE UNIQUE INDEX t5x ON t5(a+b);
INSERT INTO t5(a,b) VALUES(quote('with''quote'),trim('hello', NULL)),(julianday(0.0) -> '$[0]',0),(1,1),(0,3);
CREATE TEMP TABLE out AS SELECT DISTINCT a+b FROM t5;
CREATE TABLE t6a(x INTEGER PRIMARY KEY);
INSERT INTO t6a VALUES(1);
CREATE TABLE `t6b`(y INTEGER PRIMARY KEY);
INSERT INTO t6b VALUES(2),(3);
SELECT DISTINCT x, x FROM t6a, t6b;
SELECT * FROM out ORDER BY 1;
DROP INDEX IF EXISTS t6a;
ANALYZE;
SELECT * FROM t5;
INSERT OR REPLACE INTO t6a VALUES (NULL);
SELECT COUNT(x) FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TRIGGER IF NOT EXISTS trg_t6a_6972 BEFORE UPDATE ON t6a BEGIN INSERT INTO t6a(x) VALUES (NULL); END;
SELECT * FROM t6b AS a INNER JOIN t6b AS b ON a.rowid = b.rowid;
INSERT OR FAIL INTO t5 VALUES (NULL, 'x');
PRAGMA auto_vacuum = 1;
SELECT COUNT(*) FROM t6a;
ANALYZE t6b;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6b_6440 ON t6b((y + 1)) WHERE y > 0;
SELECT MAX(a) FROM t5;
ANALYZE t6b;
SELECT SUM(b) FROM t5;
COMMIT;
SELECT MAX(x) OVER (PARTITION BY x ORDER BY x ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t6a;
ANALYZE;
UPDATE t6b SET y = NULL WHERE 1 RETURNING *;
DROP TABLE IF EXISTS t6a;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t5_7261 ON t5(lower(a));
UPDATE t6b SET y = CURRENT_TIMESTAMP WHERE rowid = 1;
SELECT * FROM t5;
SELECT TOTAL(a) FROM t5;
SELECT COUNT(*) FROM t6a;
SELECT COUNT(*) FILTER (WHERE y IS NOT NULL), SUM(rowid) FILTER (WHERE y > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(y) FILTER (WHERE y > 0 AND y < 100), COUNT(*) FILTER (WHERE typeof(y) = "text") FROM t6b;
SELECT * FROM t6b WHERE y < (SELECT AVG(y) FROM t6b);
WITH cte AS (SELECT * FROM t5), cte2 AS (SELECT * FROM cte) SELECT * FROM cte2;
DELETE FROM t5 WHERE b > (SELECT AVG(b) FROM t5) RETURNING *;
INSERT INTO t6b SELECT * FROM t6b;
UPDATE T1 SET a = json_object('k', a) WHERE a BETWEEN 0 AND 100;
CREATE TRIGGER IF NOT EXISTS trg_T2_646 AFTER UPDATE ON T2 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
ALTER TABLE t5 RENAME COLUMN a TO a_r6349;
VACUUM;
ANALYZE t6a;
SELECT COUNT(*) FROM T2;
INSERT INTO T2 SELECT * FROM T2;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_t6a_4223 AS SELECT x FROM t6a;
INSERT INTO t5 DEFAULT VALUES;
CREATE TEMP  VIEW IF NOT EXISTS v_t6a_9754 AS SELECT x FROM t6a;
ANALYZE t5;
ALTER TABLE t6a ADD COLUMN extra_3690 NONE DEFAULT 0;
INSERT INTO T2 SELECT * FROM T2;
INSERT INTO T2 DEFAULT VALUES;
UPDATE t6b SET y = json_object('k', y);
DELETE FROM T2 WHERE rowid = 50;
CREATE TABLE T (
  a TEXT,
  b INTEGER,
  c REAL
);
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;
ANALYZE;
INSERT INTO t5 SELECT * FROM t5;
SELECT MIN(b) FROM T1;
PRAGMA journal_size_limit;
ALTER TABLE T2 ADD COLUMN extra_3722 BOOLEAN DEFAULT (abs(random()) % 1000);
SELECT COUNT(*) FROM T1;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t6b_6591 ON t6b(y) WHERE y IS NOT NULL;
VACUUM;
INSERT INTO t5 VALUES (NULL, 1) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b;
WITH cte(a, b) AS (VALUES(1, "a"),(2, "b"),(3, "c")) SELECT * FROM cte;
```

## Actual output

```sql
(no new indexes)

(null)
Memory Used:                         77839600 (max 84403008) bytes
Number of Outstanding Allocations:   17925 (max 17936)
Number of Pcache Overflow Bytes:     77515928 (max 77515928) bytes
Largest Allocation:                  6553500 bytes
Largest Pcache Allocation:           4360 bytes
Lookaside Slots Used:                37 (max 123)
Successful lookaside attempts:       7280142
Lookaside failures due to size:      2
Lookaside failures due to OOM:       54
Pager Heap Usage:                    77228192 bytes
Page cache hits:                     7216186
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Schema Heap Usage:                   992 bytes
Statement Heap/Lookaside Usage:      2528 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               2
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2528
Bytes received by read():            98930089
Bytes sent to write():               2035290
Read() system calls:                 24166
Write() system calls:                30885
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
```

## Expectation

```sql
(no new indexes)

(null)
Memory Used:                         77979168 (max 84542400) bytes
Number of Outstanding Allocations:   17959 (max 17970)
Number of Pcache Overflow Bytes:     77658136 (max 77658136) bytes
Largest Allocation:                  6553500 bytes
Largest Pcache Allocation:           4368 bytes
Lookaside Slots Used:                63 (max 123)
Successful lookaside attempts:       7280413
Lookaside failures due to size:      4
Lookaside failures due to OOM:       1682
Pager Heap Usage:                    77370408 bytes
Page cache hits:                     7216189
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Temporary data spilled to disk:      0
Schema Heap Usage:                   848 bytes
Statement Heap/Lookaside Usage:      2528 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               3
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2528
Bytes received by read():            98930609
Bytes sent to write():               2035290
Read() system calls:                 24166
Write() system calls:                30885
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
```

## Flag

```
-stats
```

