## 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
SAVEPOINT sp3356;
.import corrupt001.db main
PRAGMA recursive_triggers;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c INTEGER
);
INSERT INTO T VALUES (sign(-x'5676058c'),'a',NULL), (-strftime('%Y-%m-%d', 1),'b',1), (3,'c',2);
WITH RECURSIVE d(a,b,c,e) AS (
  SELECT *,1 FROM T WHERE NOT c IS NULL
  UNION ALL
  SELECT T.a,T.b,T.c,d.e+1
  FROM T JOIN d ON T.c=d.a
)
SELECT * FROM d;
SAVEPOINT sp5287;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.0)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE +d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.7976931348623157e+308)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;

ROLLBACK TRANSACTION TO SAVEPOINT sp5287;
RELEASE SAVEPOINT sp5287;
INSERT INTO T1 SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T_2355 BEFORE INSERT ON T FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT SUM(Y) FROM T2;
SELECT * FROM T2;
ALTER TABLE T DROP COLUMN c;
WITH RECURSIVE vals(x) AS (SELECT C FROM T1 WHERE C IS NOT NULL UNION ALL SELECT C FROM T1 WHERE C IS NOT NULL LIMIT 10) SELECT * FROM vals;
DROP TABLE IF EXISTS T2;
SELECT * FROM T AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
ALTER TABLE T1 ADD COLUMN extra_872 BIGINT NOT NULL DEFAULT 0;
DROP TABLE IF EXISTS T;
.import corrupt001.db main
PRAGMA recursive_triggers;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c INTEGER
);
INSERT INTO T VALUES (sign(1),'a',NULL), (2,'b',1), (3,'c',2);
WITH RECURSIVE d(a,b,c,e) AS (
  SELECT *,1 FROM T WHERE c IS NULL
  UNION ALL
  SELECT T.a,T.b,T.c,d.e+1
  FROM T JOIN d ON T.c=d.a
)
SELECT * FROM d;
SAVEPOINT sp5287;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.0)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.7976931348623157e+308)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;

ROLLBACK TRANSACTION TO SAVEPOINT sp5287;
RELEASE SAVEPOINT sp5287;
INSERT INTO T1 SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T_2355 BEFORE INSERT ON T FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT SUM(Y) FROM T2;
SELECT * FROM T2;
ALTER TABLE T DROP COLUMN c;
WITH RECURSIVE vals(x) AS (SELECT C FROM T1 WHERE C IS NOT NULL UNION ALL SELECT C FROM T1 WHERE C IS NOT NULL LIMIT 10) SELECT * FROM vals;
DROP TABLE IF EXISTS T2;
SELECT * FROM T AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
ALTER TABLE T1 ADD COLUMN extra_872 BIGINT NOT NULL DEFAULT 0;
DROP TABLE IF EXISTS T;
.import corrupt001.db main
PRAGMA recursive_triggers;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c INTEGER
);
INSERT INTO T VALUES (sign(1),'a',NULL), (2,'b',1), (3,'c',2);
WITH RECURSIVE d(a,b,c,e) AS (
  SELECT *,1 FROM T WHERE c IS NULL
  UNION ALL
  SELECT T.a,T.b,T.c,d.e+1
  FROM T JOIN d ON T.c=d.a
)
SELECT * FROM d;
SAVEPOINT sp5287;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.0)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.7976931348623157e+308)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;

ROLLBACK TRANSACTION TO SAVEPOINT sp5287;
RELEASE SAVEPOINT sp5287;
INSERT INTO T1 SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T_2355 BEFORE INSERT ON T FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT SUM(Y) FROM T2;
SELECT * FROM T2;
ALTER TABLE T DROP COLUMN c;
WITH RECURSIVE vals(x) AS (SELECT C FROM T1 WHERE C IS NOT NULL UNION ALL SELECT C FROM T1 WHERE C IS NOT NULL LIMIT 10) SELECT * FROM vals;
DROP TABLE IF EXISTS T2;
SELECT * FROM T AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
ALTER TABLE T1 ADD COLUMN extra_872 BIGINT NOT NULL DEFAULT 0;
DROP TABLE IF EXISTS T;
.import corrupt001.db main
PRAGMA recursive_triggers;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c INTEGER
);
INSERT INTO T VALUES (sign(1),'a',NULL), (2,'b',1), (3,'c',2);
WITH RECURSIVE d(a,b,c,e) AS (
  SELECT *,1 FROM T WHERE c IS NULL
  UNION ALL
  SELECT T.a,T.b,T.c,d.e+1
  FROM T JOIN d ON T.c=d.a
)
SELECT * FROM d;
SAVEPOINT sp5287;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.0)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.7976931348623157e+308)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;

ROLLBACK TRANSACTION TO SAVEPOINT sp5287;
RELEASE SAVEPOINT sp5287;
INSERT INTO T1 SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T_2355 BEFORE INSERT ON T FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT SUM(Y) FROM T2;
SELECT * FROM T2;
ALTER TABLE T DROP COLUMN c;
WITH RECURSIVE vals(x) AS (SELECT C FROM T1 WHERE C IS NOT NULL UNION ALL SELECT C FROM T1 WHERE C IS NOT NULL LIMIT 10) SELECT * FROM vals;
DROP TABLE IF EXISTS T2;
SELECT * FROM T AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
ALTER TABLE T1 ADD COLUMN extra_872 BIGINT NOT NULL DEFAULT 0;
DROP TABLE IF EXISTS T;
.import corrupt001.db main
PRAGMA recursive_triggers;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c INTEGER
);
INSERT INTO T VALUES (sign(1),'a',NULL), (2,'b',1), (3,'c',2);
WITH RECURSIVE d(a,b,c,e) AS (
  SELECT *,1 FROM T WHERE c IS NULL
  UNION ALL
  SELECT T.a,T.b,T.c,d.e+1
  FROM T JOIN d ON T.c=d.a
)
SELECT * FROM d;
SAVEPOINT sp5287;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.0)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.7976931348623157e+308)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;

ROLLBACK TRANSACTION TO SAVEPOINT sp5287;
RELEASE SAVEPOINT sp5287;
INSERT INTO T1 SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T_2355 BEFORE INSERT ON T FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT SUM(Y) FROM T2;
SELECT * FROM T2;
ALTER TABLE T DROP COLUMN c;
WITH RECURSIVE vals(x) AS (SELECT C FROM T1 WHERE C IS NOT NULL UNION ALL SELECT C FROM T1 WHERE C IS NOT NULL LIMIT 10) SELECT * FROM vals;
DROP TABLE IF EXISTS T2;
SELECT * FROM T AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
ALTER TABLE T1 ADD COLUMN extra_872 BIGINT NOT NULL DEFAULT 0;
DROP TABLE IF EXISTS T;
.import corrupt001.db main
PRAGMA recursive_triggers;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c INTEGER
);
INSERT INTO T VALUES (sign(1),'a',NULL), (2,'b',1), (3,'c',2);
WITH RECURSIVE d(a,b,c,e) AS (
  SELECT *,1 FROM T WHERE c IS NULL
  UNION ALL
  SELECT T.a,T.b,T.c,d.e+1
  FROM T JOIN d ON T.c=d.a
)
SELECT * FROM d;
SAVEPOINT sp5287;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.0)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;
.echo off
.quit
.import corrupt001.db main
BEGIN EXCLUSIVE TRANSACTION;
-- timediff(NULL, {v})timediff(NULL, NULL)

.exit printf('%s %s', 'true', 1.7976931348623157e+308)
PRAGMA vdbe_listing = FALSE;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE T2 (
  A VARCHAR(20),
  Y VARCHAR(10) UNIQUE,
  PRIMARY KEY (A, Y)
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T2 VALUES ('b', 'k');
SELECT A FROM T1 UNION ALL SELECT A FROM T2 ORDER BY A;
.((connection))
ATTACH DATABASE ':memory:' AS aux71;
CREATE TABLE T1 (
  A VARCHAR(jsonb_group_array((9223372036854775808 * 1))) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C SMALLINT
);
CREATE TABLE /**/ T2 (
  X VARCHAR(20) PRIMARY KEY,
  A VARCHAR(10) NOT NULL UNIQUE,
  FOREIGN KEY (A) REFERENCES T1(A)
);
INSERT INTO T1 VALUES ('a', 'p', -2147483648);
INSERT INTO T1 VALUES ('b', 'q', 2147483647);
INSERT /**/ INTO T2 VALUES ('m', 'a');
INSERT INTO T2 VALUES ('n', 'b');
SELECT T2.X, T1.B, T1.C FROM T2, T1 WHERE NOT T2.A IS T1.A AND T1.C >= 0;
PRAGMA shrink_memory;
PRAGMA auto_vacuum = NONE;
PRAGMA journal_mode = 'TRUNCATE';
.tables
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL,
  d REAL
);
INSERT INTO T VALUES (1,'a',40.5,-70.0), (2,'b',-10.25,20.5), (3,'c',9e999,-9e999);
SELECT b FROM T WHERE ABS(c) > 5 AND ABS(d) > 5;
ALTER TABLE T DROP COLUMN b;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T_6632 AS SELECT b FROM T;
DETACH DATABASE aux71;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
CREATE TRIGGER IF NOT EXISTS trg_T1_1019 BEFORE DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT COUNT(*) FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
INSERT OR REPLACE INTO T1 VALUES (NULL, 'x', '');
SELECT GROUP_CONCAT(B, '.') OVER (PARTITION BY B ORDER BY B ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM T1;
SELECT NTILE(4) OVER (PARTITION BY a ORDER BY a RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T;
PRAGMA module_list;
INSERT INTO T VALUES (1, 1, 1, NULL) ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
SELECT COUNT(*) FILTER (WHERE d IS NOT NULL), SUM(rowid) FILTER (WHERE d > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(d) FILTER (WHERE d > 0 AND d < 100), COUNT(*) FILTER (WHERE typeof(d) = "text") FROM T;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<87) SELECT * FROM cnt;
SELECT LAG(C, 2, C) OVER (ORDER BY C GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) FROM T1;
COMMIT;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T ADD COLUMN extra_893 DOUBLE PRECISION DEFAULT NULL;
UPDATE T2 SET A = 'x';
SELECT * FROM T1 WHERE EXISTS (SELECT 1 FROM T1 WHERE C = NULL);
SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T1_9656 BEFORE INSERT ON T1 BEGIN SELECT RAISE(IGNORE); END;
SELECT * FROM T2;
SELECT * FROM (SELECT * FROM (SELECT * FROM T1) AS inner1) AS inner2;
SELECT DENSE_RANK() OVER (PARTITION BY A ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T1;
ALTER TABLE T RENAME TO T_r7265;
CREATE  VIEW IF NOT EXISTS v_T2_6077 AS SELECT X FROM T2;
SELECT LAG(A, 2) OVER (ORDER BY A RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE NO OTHERS) FROM T2;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<95) SELECT a, n FROM fib;
CREATE TRIGGER IF NOT EXISTS trg_T_6163 BEFORE UPDATE ON T BEGIN SELECT RAISE(ABORT, 'abort'); END;
DROP TABLE IF EXISTS T;
SELECT * FROM T WHERE b < ALL (SELECT b FROM T);
SELECT * FROM T1 AS a RIGHT OUTER JOIN T2 AS b ON a.rowid = b.rowid;
ALTER TABLE T2 DROP COLUMN A;
REINDEX;
CREATE TRIGGER IF NOT EXISTS trg_T1_5939 AFTER DELETE ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
PRAGMA case_sensitive_like = NO;
INSERT INTO T1 VALUES (1, NULL, NULL) ON CONFLICT(A) DO UPDATE SET A = excluded.A, B = excluded.B, C = excluded.C;
ANALYZE T1;

ROLLBACK TRANSACTION TO SAVEPOINT sp5287;
RELEASE SAVEPOINT sp5287;
INSERT INTO T1 SELECT * FROM T1;
CREATE TRIGGER IF NOT EXISTS trg_T_2355 BEFORE INSERT ON T FOR EACH ROW BEGIN SELECT RAISE(IGNORE); END;
SELECT SUM(Y) FROM T2;
SELECT * FROM T2;
ALTER TABLE T DROP COLUMN c;
WITH RECURSIVE vals(x) AS (SELECT C FROM T1 WHERE C IS NOT NULL UNION ALL SELECT C FROM T1 WHERE C IS NOT NULL LIMIT 10) SELECT * FROM vals;
DROP TABLE IF EXISTS T2;
SELECT * FROM T AS a LEFT JOIN T1 AS b ON a.rowid = b.rowid;
ALTER TABLE T1 ADD COLUMN extra_872 BIGINT NOT NULL DEFAULT 0;
DROP TABLE IF EXISTS T;

WITH cte AS (SELECT * FROM T) SELECT * FROM cte WHERE a > 0 UNION ALL SELECT * FROM cte WHERE a <= 0;
WITH cte AS (SELECT * FROM T2 LIMIT 1) DELETE FROM T2 WHERE A IN (SELECT A FROM cte) AND 1=0;
ANALYZE T2;
SELECT STRING_AGG(d) FROM T;
VACUUM;
INSERT INTO T2 VALUES (NULL, 'x') ON CONFLICT(A) DO UPDATE SET A = excluded.A, Y = excluded.Y;
ALTER TABLE T2 RENAME COLUMN A TO A_r8005;
INSERT INTO T DEFAULT VALUES;
REINDEX;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T1_767 AS SELECT A FROM T1;
CREATE TABLE T (
  a INTEGER,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES (1,'a',1.25), (2,'b',-3.5), (3,'c',9e999);
WITH d AS (SELECT * FROM T) SELECT * FROM d WHERE c > 0;
ROLLBACK TO sp3356;
RELEASE sp3356;
```

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

