## 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 aux76;
ATTACH DATABASE ':memory:' AS aux17;
ATTACH DATABASE ':memory:' AS aux93;
.echo on
BEGIN;
-- .dump main

SAVEPOINT sp6123;
.exit -(ifnull('	', NULL) * exp(sign(--(-(2147483649)))))
PRAGMA defer_foreign_keys = OFF;
BEGIN TRANSACTION;
ATTACH DATABASE ':memory:' AS aux64;
PRAGMA count_changes = TRUE;
PRAGMA wal_checkpoint('NOOP');
PRAGMA soft_heap_limit = '-';
BEGIN TRANSACTION;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(unlikely(like('%MiXeD%', unhex('4865', 'x'))), '$.key', CAST(x'd863506cea7ae2be62640fe9dee9' AS NUMERIC)))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a NATURAL JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(9223372036854775808, '$.key', 9223372036854775808))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(9223372036854775808, '$.key', 9223372036854775808))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(9223372036854775808, '$.key', 9223372036854775808))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO
T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(9223372036854775808, '$.key', 9223372036854775808))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(9223372036854775808, '$.key', 9223372036854775808))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(9223372036854775808, '$.key', 9223372036854775808))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(9223372036854775808, '$.key', 9223372036854775808))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;
SAVEPOINT sp5901;
.exit
CREATE TABLE main.T (
  A VARCHAR(coalesce(NULL, NULL, NULL)) PRIMARY KEY,
  B VARCHAR(CAST(atan2(-(-(json_set(9223372036854775808, '$.key', 9223372036854775808))), 9223372036854775808) AS NUMERIC)) NOT NULL,
  C DATE UNIQUE
);
INSERT INTO T VALUES ('' || ('a'), 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE NOT C > 0 ORDER BY C DESC;
BEGIN;
CREATE TABLE main.t1(w int, x int, y int, z int);
CREATE UNIQUE INDEX i1w ON t1(w);
CREATE INDEX i1xy ON t1(x,y);
CREATE INDEX i1zyx ON t1(z,y,x);
COMMIT;
SELECT * FROM t1 WHERE w BETWEEN 5 AND 6 ORDER BY +w;
SELECT * FROM t1 WHERE +w BETWEEN 5 AND 65-y ORDER BY +w;

INSERT INTO T SELECT * FROM T;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
PRAGMA short_column_names = OFF;
ROLLBACK TO sp5901;
RELEASE sp5901;
ANALYZE;
SELECT NTILE(-1) OVER (ORDER BY C ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM T;
SELECT * FROM T;
ALTER TABLE T DROP COLUMN A;
INSERT OR FAIL INTO t1 VALUES (0, 0, 0, 'x');
SELECT * FROM t1 AS a FULL OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT * FROM T WHERE A = (SELECT COUNT(*) FROM T);
ANALYZE;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',100.0), ('b',-200.5), ('c',9e999);
SELECT a,b,
LEAD(b,1) OVER (ORDER BY b DESC) AS c,
NTILE(2) OVER (ORDER BY b DESC) AS d FROM T;
ALTER TABLE t1 DROP COLUMN w;

END TRANSACTION;
PRAGMA writable_schema = FALSE;
WITH cte AS (SELECT a, COUNT(*) AS cnt FROM T GROUP BY a) SELECT * FROM cte WHERE cnt > 1;
CREATE TRIGGER IF NOT EXISTS trg_t1_6599 BEFORE UPDATE OF y ON t1 FOR EACH ROW BEGIN INSERT INTO t1(y) VALUES (NULL); END;
VACUUM;
SELECT MAX(w) FROM t1;
SELECT COUNT(*) FROM t1;
DELETE FROM t1 WHERE z > (SELECT AVG(z) FROM t1);
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T);
WITH a AS (SELECT * FROM t1), b AS (SELECT * FROM t1) SELECT * FROM a UNION ALL SELECT * FROM b;
WITH RECURSIVE cnt(x) AS (VALUES(0) UNION ALL SELECT x-1 FROM cnt WHERE x>-57) SELECT * FROM cnt;
SELECT * FROM T AS a FULL OUTER JOIN t1 AS b ON a.rowid = b.rowid;
DETACH DATABASE aux64;
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;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_4313 AS SELECT B FROM T;
ANALYZE;
ALTER TABLE T ADD COLUMN extra_4598 INTEGER COLLATE RTRIM;
DROP INDEX IF EXISTS T;
SELECT SUM(w) FROM t1;

SELECT COUNT(*) FROM T;
SELECT SUM(B) FROM 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;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
REINDEX t1;
SELECT LAG(x, 2, 'default') OVER (ORDER BY x ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
END;
SELECT * FROM t1;
RELEASE sp6123;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
END;
DROP VIEW IF EXISTS T;
SELECT * FROM t1;
DROP VIEW IF EXISTS T;
ALTER TABLE t1 DROP COLUMN w;
CREATE TABLE T (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) NOT NULL,
  C DOUBLE PRECISION
);
INSERT INTO T VALUES ('a', 'p', -1.7976931348623157e+308);
INSERT INTO T VALUES ('b', 'q', -0.000000001);
INSERT INTO T VALUES ('c', 'r', 0.0);
INSERT INTO T VALUES ('d', 's', 3.14159265358979);
INSERT INTO T VALUES ('e', 't', 1.7976931348623157e+308);
INSERT INTO T VALUES ('f', 't', 750.25);
SELECT B, AVG(C) AS D, MIN(C) AS E, MAX(C) AS F FROM T GROUP BY B;
WITH cte AS (SELECT * FROM t1 ORDER BY y LIMIT 5) SELECT * FROM cte;
DETACH DATABASE aux93;
INSERT OR FAIL INTO t1 VALUES (NULL, 'x', NULL, '');
INSERT OR ROLLBACK INTO T VALUES (NULL, '', NULL);
SELECT LAG(y, 0) OVER (PARTITION BY y ORDER BY y ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM t1;
SELECT COUNT(z) FROM t1;
creATE VIRTUAL TABLE t0 USING fts3("x", "y", "z");
DROP TABLE t0;
INSERT INTO t1 SELECT * FROM t1;
DROP TRIGGER IF EXISTS T;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;

WITH cte AS (SELECT * FROM t1) SELECT * FROM cte JOIN t1 ON cte.y = t1.y;
SELECT COUNT(B) FILTER (WHERE NULL) OVER (PARTITION BY B ORDER BY B ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) FROM T;
SELECT MIN(B) FILTER (WHERE B IS NOT NULL) OVER (ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
INSERT INTO t1 VALUES ('x', NULL, 1, 'x') ON CONFLICT(w) DO UPDATE SET w = excluded.w, x = excluded.x, y = excluded.y;
UPDATE T SET B = '' WHERE rowid = 1 RETURNING *;
INSERT INTO t1 DEFAULT VALUES;
SELECT * FROM T WHERE NOT EXISTS (SELECT 1 FROM T WHERE 1 = 0);
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;
ALTER TABLE T DROP COLUMN C;
DETACH DATABASE aux17;
SELECT GROUP_CONCAT(y, y) OVER (PARTITION BY y ORDER BY y GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM t1;
ANALYZE t1;
ANALYZE;
INSERT OR ROLLBACK INTO T VALUES (4, NULL, 'x');
DROP INDEX IF EXISTS T;
INSERT OR IGNORE INTO T VALUES ('', 'x', '');
UPDATE t1 SET x = NULL WHERE rowid = 1;
CREATE TRIGGER IF NOT EXISTS trg_T_5846 BEFORE DELETE ON T BEGIN SELECT RAISE(IGNORE); END;
DETACH DATABASE aux76;
CREATE TEMPORARY TABLE t0(x, y, z);
SELECT -99999999999999999999999999999999999999999999999999;
SELECT * FROM sqlite_temp_master WHERE sql GLOB '000[]***';
DROP TABLE t0;
ALTER TABLE t0 ADD COLUMN extra_7447 DOUBLE NOT NULL DEFAULT 0;
ALTER TABLE T DROP COLUMN A;
SELECT LAG(B, 0, 'default') OVER (ORDER BY B RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM T;
```

## Actual output

```sql
Memory Used:                         79920 (max 79920) bytes
Number of Outstanding Allocations:   158 (max 158)
Number of Pcache Overflow Bytes:     16928 (max 16928) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4360 bytes
Lookaside Slots Used:                40 (max 80)
Successful lookaside attempts:       138
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    18496 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Schema Heap Usage:                   1104 bytes
Statement Heap/Lookaside Usage:      2912 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               7
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2912
Bytes received by read():            10409
Bytes sent to write():               0
Read() system calls:                 13
Write() system calls:                0
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
Memory Used:                         92136 (max 92136) bytes
Number of Outstanding Allocations:   175 (max 175)
Number of Pcache Overflow Bytes:     25392 (max 25392) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4360 bytes
Lookaside Slots Used:                41 (max 81)
Successful lookaside attempts:       195
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    27744 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Schema Heap Usage:                   1472 bytes
Statement Heap/Lookaside Usage:      2912 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               7
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2912
Bytes received by read():            10504
Bytes sent to write():               1293
Read() system calls:                 15
Write() system calls:                1
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
Memory Used:                         104352 (max 104352) bytes
Number of Outstanding Allocations:   192 (max 192)
Number of Pcache Overflow Bytes:     33856 (max 33856) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4360 bytes
Lookaside Slots Used:                42 (max 82)
Successful lookaside attempts:       253
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    36992 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Schema Heap Usage:                   1840 bytes
Statement Heap/Lookaside Usage:      2912 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               7
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2912
Bytes received by read():            10602
Bytes sent to write():               2589
Read() system calls:                 17
Write() system calls:                2
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
BEGIN;
Memory Used:                         104352 (max 104352) bytes
Number of Outstanding Allocations:   192 (max 192)
Number of Pcache Overflow Bytes:     33856 (max 33856) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4360 bytes
Lookaside Slots Used:                39 (max 82)
Successful lookaside attempts:       256
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    36992 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Schema Heap Usage:                   1840 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():            10700
Bytes sent to write():               3887
Read() system calls:                 19
Write() system calls:                3
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
-- .dump main

SAVEPOINT sp6123;
Memory Used:                         104352 (max 104352) bytes
Number of Outstanding Allocations:   192 (max 192)
Number of Pcache Overflow Bytes:     33856 (max 33856) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4360 bytes
Lookaside Slots Used:                41 (max 82)
Successful lookaside attempts:       261
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    36992 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Schema Heap Usage:                   1840 bytes
Statement Heap/Lookaside Usage:      2656 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:        2656
Bytes received by read():            10798
Bytes sent to write():               5207
Read() system calls:                 21
Write() system calls:                6
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
.exit -(ifnull('	', NULL) * exp(sign(--(-(2147483649)))))
```

## Expectation

```sql
Memory Used:                         80568 (max 80568) bytes
Number of Outstanding Allocations:   168 (max 168)
Number of Pcache Overflow Bytes:     16944 (max 16944) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4368 bytes
Lookaside Slots Used:                56 (max 91)
Successful lookaside attempts:       144
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    18512 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Temporary data spilled to disk:      0
Schema Heap Usage:                   944 bytes
Statement Heap/Lookaside Usage:      2912 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               8
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2912
Bytes received by read():            11185
Bytes sent to write():               0
Read() system calls:                 14
Write() system calls:                0
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
Memory Used:                         92720 (max 92720) bytes
Number of Outstanding Allocations:   185 (max 185)
Number of Pcache Overflow Bytes:     25416 (max 25416) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4368 bytes
Lookaside Slots Used:                57 (max 92)
Successful lookaside attempts:       196
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    27768 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Temporary data spilled to disk:      0
Schema Heap Usage:                   1256 bytes
Statement Heap/Lookaside Usage:      2912 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               8
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2912
Bytes received by read():            11280
Bytes sent to write():               1331
Read() system calls:                 16
Write() system calls:                1
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
Memory Used:                         104872 (max 104872) bytes
Number of Outstanding Allocations:   202 (max 202)
Number of Pcache Overflow Bytes:     33888 (max 33888) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4368 bytes
Lookaside Slots Used:                58 (max 93)
Successful lookaside attempts:       249
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    37024 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Temporary data spilled to disk:      0
Schema Heap Usage:                   1568 bytes
Statement Heap/Lookaside Usage:      2912 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               8
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2912
Bytes received by read():            11378
Bytes sent to write():               2666
Read() system calls:                 18
Write() system calls:                2
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
BEGIN;
Memory Used:                         104872 (max 104872) bytes
Number of Outstanding Allocations:   202 (max 202)
Number of Pcache Overflow Bytes:     33888 (max 33888) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4368 bytes
Lookaside Slots Used:                55 (max 93)
Successful lookaside attempts:       252
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    37024 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Temporary data spilled to disk:      0
Schema Heap Usage:                   1568 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():            11476
Bytes sent to write():               4010
Read() system calls:                 20
Write() system calls:                4
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
-- .dump main

SAVEPOINT sp6123;
Memory Used:                         104872 (max 104872) bytes
Number of Outstanding Allocations:   202 (max 202)
Number of Pcache Overflow Bytes:     33888 (max 33888) bytes
Largest Allocation:                  48000 bytes
Largest Pcache Allocation:           4368 bytes
Lookaside Slots Used:                57 (max 93)
Successful lookaside attempts:       257
Lookaside failures due to size:      0
Lookaside failures due to OOM:       0
Pager Heap Usage:                    37024 bytes
Page cache hits:                     0
Page cache misses:                   0
Page cache writes:                   0
Page cache spills:                   0
Temporary data spilled to disk:      0
Schema Heap Usage:                   1568 bytes
Statement Heap/Lookaside Usage:      2656 bytes
Fullscan Steps:                      0
Sort Operations:                     0
Autoindex Inserts:                   0
Virtual Machine Steps:               4
Reprepare operations:                0
Number of times run:                 1
Memory used by prepared stmt:        2656
Bytes received by read():            11574
Bytes sent to write():               5380
Read() system calls:                 22
Write() system calls:                8
Bytes read from storage:             0
Bytes written to storage:            0
Cancelled write bytes:               0
.exit -(ifnull('	', NULL) * exp(sign(--(-(2147483649)))))
```

## Flag

```
-stats
```

