## 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
PRAGMA defer_foreign_keys = FALSE;
ATTACH DATABASE ':memory:' AS aux65;
.bail on
.lint
.dbconfig fk on
ATTACH DATABASE ':memory:' AS aux77;
-- max(1, 2, 3, 4, 5)

.headers on
PRAGMA automatic_index = NO;
PRAGMA automatic_index = YES;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',load_extension(NULL)), ('b',-jsonb_extract(exp(round(x'05e5de5c256042c731d3c19b9b', json_remove(json_quote(sign(if(log10(1), 1, 1))), '$.key', '$[0]'))), '$')), ('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;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE `t1`(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d /* .dump main */ ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
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;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN /**/ SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
ALTER TABLE t1 RENAME TO t1_r1422;
SELECT COUNT(*) FROM T;
SELECT COUNT(*) FROM t1;
INSERT OR REPLACE INTO t1 VALUES (0, '', '', NULL);
SELECT * FROM T;
SELECT AVG(a) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT MAX(a) FROM T;
CREATE TRIGGER IF NOT EXISTS trg_T_9386 AFTER UPDATE OF b ON T BEGIN INSERT INTO T(b) VALUES (NULL); END;
INSERT INTO t1 VALUES (NULL, NULL, 1, 'x') ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
INSERT INTO T DEFAULT VALUES;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL), SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T;
DETACH DATABASE aux77;
DELETE FROM T WHERE rowid = 8 RETURNING *;
CREATE  INDEX IF NOT EXISTS idx_t1_6079 ON t1(a COLLATE NOCASE) WHERE a IS NOT NULL;
REINDEX t1;
ALTER TABLE T ADD COLUMN extra_3272 REAL;
ANALYZE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET b = b + 1 WHERE b IS NOT NULL RETURNING *;
SELECT * FROM t1 AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T1 (
  A VARCHAR(20) PRIMARY KEY,
  X VARCHAR(10) UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(20) PRIMARY KEY,
  Y VARCHAR(10) UNIQUE
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
INSERT INTO T2 VALUES ('c', 'l');
SELECT A FROM T1 INTERSECT SELECT A FROM T2;
ALTER TABLE T ADD COLUMN extra_595 ANY DEFAULT CURRENT_TIMESTAMP;
CREATE TRIGGER IF NOT EXISTS trg_T1_5859 BEFORE UPDATE OF X ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT SUM(a) FROM T;
DETACH DATABASE aux65;
ALTER TABLE T1 RENAME TO T1_r8707;
REINDEX T1;
PRAGMA fullsync = 1;
ALTER TABLE T2 ADD COLUMN extra_6787 ANY DEFAULT '';
INSERT INTO t1 DEFAULT VALUES;
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 T2;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T1 ADD COLUMN extra_1253 NONE;
VACUUM main;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
SELECT * FROM T1;
ALTER TABLE t1 DROP COLUMN d;
WITH cte(a, b) AS (VALUES(1, "a"),(2, "b"),(3, "c")) SELECT * FROM cte;
ALTER TABLE T2 RENAME TO T2_r4636;
UPDATE t1 SET a = a + 1 WHERE rowid = 1;
ALTER TABLE T RENAME COLUMN c TO c_r4979;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T WHERE c > 0);
CREATE TEMP  VIEW IF NOT EXISTS v_T2_3277 AS SELECT Y FROM T2;
UPDATE T2 SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
VACUUM;
ANALYZE T2;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_9212 ON T1(A COLLATE NOCASE);
INSERT OR FAIL INTO T VALUES ('', '', NULL);
WITH cte(x) AS (VALUES(NULL),(1),(NULL)) SELECT * FROM cte WHERE x IS NOT NULL;
REINDEX;
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 T2;

SELECT COUNT(*) FROM T2;
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA defer_foreign_keys = FALSE;
ATTACH DATABASE ':memory:' AS aux65;
.bail on
.lint
.dbconfig fk on
ATTACH DATABASE ':memory:' AS aux77;
-- max(1, 2, 3, 4, 5)

.headers on
PRAGMA automatic_index = NO;
PRAGMA automatic_index = YES;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',load_extension(NULL)), ('b',-jsonb_extract(exp(round(x'05e5de5c256042c731d3c19b9b', json_remove(json_quote(sign(1)), '$.key', '$[0]'))), '$')), ('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;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE `t1`(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d /* .dump main */ ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
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;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN /**/ SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
ALTER TABLE t1 RENAME TO t1_r1422;
SELECT COUNT(*) FROM T;
SELECT COUNT(*) FROM t1;
INSERT OR REPLACE INTO t1 VALUES (0, '', '', NULL);
SELECT * FROM T;
SELECT AVG(a) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT MAX(a) FROM T;
CREATE TRIGGER IF NOT EXISTS trg_T_9386 AFTER UPDATE OF b ON T BEGIN INSERT INTO T(b) VALUES (NULL); END;
INSERT INTO t1 VALUES (NULL, NULL, 1, 'x') ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
INSERT INTO T DEFAULT VALUES;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL), SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T;
DETACH DATABASE aux77;
DELETE FROM T WHERE rowid = 8 RETURNING *;
CREATE  INDEX IF NOT EXISTS idx_t1_6079 ON t1(a COLLATE NOCASE) WHERE a IS NOT NULL;
REINDEX t1;
ALTER TABLE T ADD COLUMN extra_3272 REAL;
ANALYZE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET b = b + 1 WHERE b IS NOT NULL RETURNING *;
SELECT * FROM t1 AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T1 (
  A VARCHAR(20) PRIMARY KEY,
  X VARCHAR(10) UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(20) PRIMARY KEY,
  Y VARCHAR(10) UNIQUE
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
INSERT INTO T2 VALUES ('c', 'l');
SELECT A FROM T1 INTERSECT SELECT A FROM T2;
ALTER TABLE T ADD COLUMN extra_595 ANY DEFAULT CURRENT_TIMESTAMP;
CREATE TRIGGER IF NOT EXISTS trg_T1_5859 BEFORE UPDATE OF X ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT SUM(a) FROM T;
DETACH DATABASE aux65;
ALTER TABLE T1 RENAME TO T1_r8707;
REINDEX T1;
PRAGMA fullsync = 1;
ALTER TABLE T2 ADD COLUMN extra_6787 ANY DEFAULT '';
INSERT INTO t1 DEFAULT VALUES;
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 T2;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T1 ADD COLUMN extra_1253 NONE;
VACUUM main;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
SELECT * FROM T1;
ALTER TABLE t1 DROP COLUMN d;
WITH cte(a, b) AS (VALUES(1, "a"),(2, "b"),(3, "c")) SELECT * FROM cte;
ALTER TABLE T2 RENAME TO T2_r4636;
UPDATE t1 SET a = a + 1 WHERE rowid = 1;
ALTER TABLE T RENAME COLUMN c TO c_r4979;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T WHERE c > 0);
CREATE TEMP  VIEW IF NOT EXISTS v_T2_3277 AS SELECT Y FROM T2;
UPDATE T2 SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
VACUUM;
ANALYZE T2;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_9212 ON T1(A COLLATE NOCASE);
INSERT OR FAIL INTO T VALUES ('', '', NULL);
WITH cte(x) AS (VALUES(NULL),(1),(NULL)) SELECT * FROM cte WHERE x IS NOT NULL;
REINDEX;
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 T2;

SELECT COUNT(*) FROM T2;
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA defer_foreign_keys = FALSE;
ATTACH DATABASE ':memory:' AS aux65;
.bail on
.lint
.dbconfig fk on
ATTACH DATABASE ':memory:' AS aux77;
-- max(1, 2, 3, 4, 5)

.headers on
PRAGMA automatic_index = NO;
PRAGMA automatic_index = YES;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',load_extension(NULL)), ('b',-jsonb_extract(exp(round(x'05e5de5c256042c731d3c19b9b', json_remove(json_quote(sign(1)), '$.key', '$[0]'))), '$')), ('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;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE `t1`(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d /* .dump main */ ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
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;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN /**/ SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
ALTER TABLE t1 RENAME TO t1_r1422;
SELECT COUNT(*) FROM T;
SELECT COUNT(*) FROM t1;
INSERT OR REPLACE INTO t1 VALUES (0, '', '', NULL);
SELECT * FROM T;
SELECT AVG(a) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT MAX(a) FROM T;
CREATE TRIGGER IF NOT EXISTS trg_T_9386 AFTER UPDATE OF b ON T BEGIN INSERT INTO T(b) VALUES (NULL); END;
INSERT INTO t1 VALUES (NULL, NULL, 1, 'x') ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
INSERT INTO T DEFAULT VALUES;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL), SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T;
DETACH DATABASE aux77;
DELETE FROM T WHERE rowid = 8 RETURNING *;
CREATE  INDEX IF NOT EXISTS idx_t1_6079 ON t1(a COLLATE NOCASE) WHERE a IS NOT NULL;
REINDEX t1;
ALTER TABLE T ADD COLUMN extra_3272 REAL;
ANALYZE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET b = b + 1 WHERE b IS NOT NULL RETURNING *;
SELECT * FROM t1 AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T1 (
  A VARCHAR(20) PRIMARY KEY,
  X VARCHAR(10) UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(20) PRIMARY KEY,
  Y VARCHAR(10) UNIQUE
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
INSERT INTO T2 VALUES ('c', 'l');
SELECT A FROM T1 INTERSECT SELECT A FROM T2;
ALTER TABLE T ADD COLUMN extra_595 ANY DEFAULT CURRENT_TIMESTAMP;
CREATE TRIGGER IF NOT EXISTS trg_T1_5859 BEFORE UPDATE OF X ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT SUM(a) FROM T;
DETACH DATABASE aux65;
ALTER TABLE T1 RENAME TO T1_r8707;
REINDEX T1;
PRAGMA fullsync = 1;
ALTER TABLE T2 ADD COLUMN extra_6787 ANY DEFAULT '';
INSERT INTO t1 DEFAULT VALUES;
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 T2;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T1 ADD COLUMN extra_1253 NONE;
VACUUM main;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
SELECT * FROM T1;
ALTER TABLE t1 DROP COLUMN d;
WITH cte(a, b) AS (VALUES(1, "a"),(2, "b"),(3, "c")) SELECT * FROM cte;
ALTER TABLE T2 RENAME TO T2_r4636;
UPDATE t1 SET a = a + 1 WHERE rowid = 1;
ALTER TABLE T RENAME COLUMN c TO c_r4979;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T WHERE c > 0);
CREATE TEMP  VIEW IF NOT EXISTS v_T2_3277 AS SELECT Y FROM T2;
UPDATE T2 SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
VACUUM;
ANALYZE T2;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_9212 ON T1(A COLLATE NOCASE);
INSERT OR FAIL INTO T VALUES ('', '', NULL);
WITH cte(x) AS (VALUES(NULL),(1),(NULL)) SELECT * FROM cte WHERE x IS NOT NULL;
REINDEX;
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 T2;

SELECT COUNT(*) FROM T2;
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA defer_foreign_keys = FALSE;
ATTACH DATABASE ':memory:' AS aux65;
.bail on
.lint
.dbconfig fk on
ATTACH DATABASE ':memory:' AS aux77;
-- max(1, 2, 3, 4, 5)

.headers on
PRAGMA automatic_index = NO;
PRAGMA automatic_index = YES;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',load_extension(NULL)), ('b',-jsonb_extract(exp(round(x'05e5de5c256042c731d3c19b9b', json_remove(json_quote(sign(1)), '$.key', '$[0]'))), '$')), ('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;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE `t1`(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d /* .dump main */ ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
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;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN /**/ SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
ALTER TABLE t1 RENAME TO t1_r1422;
SELECT COUNT(*) FROM T;
SELECT COUNT(*) FROM t1;
INSERT OR REPLACE INTO t1 VALUES (0, '', '', NULL);
SELECT * FROM T;
SELECT AVG(a) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT MAX(a) FROM T;
CREATE TRIGGER IF NOT EXISTS trg_T_9386 AFTER UPDATE OF b ON T BEGIN INSERT INTO T(b) VALUES (NULL); END;
INSERT INTO t1 VALUES (NULL, NULL, 1, 'x') ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
INSERT INTO T DEFAULT VALUES;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL), SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T;
DETACH DATABASE aux77;
DELETE FROM T WHERE rowid = 8 RETURNING *;
CREATE  INDEX IF NOT EXISTS idx_t1_6079 ON t1(a COLLATE NOCASE) WHERE a IS NOT NULL;
REINDEX t1;
ALTER TABLE T ADD COLUMN extra_3272 REAL;
ANALYZE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET b = b + 1 WHERE b IS NOT NULL RETURNING *;
SELECT * FROM t1 AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T1 (
  A VARCHAR(20) PRIMARY KEY,
  X VARCHAR(10) UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(20) PRIMARY KEY,
  Y VARCHAR(10) UNIQUE
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
INSERT INTO T2 VALUES ('c', 'l');
SELECT A FROM T1 INTERSECT SELECT A FROM T2;
ALTER TABLE T ADD COLUMN extra_595 ANY DEFAULT CURRENT_TIMESTAMP;
CREATE TRIGGER IF NOT EXISTS trg_T1_5859 BEFORE UPDATE OF X ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT SUM(a) FROM T;
DETACH DATABASE aux65;
ALTER TABLE T1 RENAME TO T1_r8707;
REINDEX T1;
PRAGMA fullsync = 1;
ALTER TABLE T2 ADD COLUMN extra_6787 ANY DEFAULT '';
INSERT INTO t1 DEFAULT VALUES;
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 T2;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T1 ADD COLUMN extra_1253 NONE;
VACUUM main;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
SELECT * FROM T1;
ALTER TABLE t1 DROP COLUMN d;
WITH cte(a, b) AS (VALUES(1, "a"),(2, "b"),(3, "c")) SELECT * FROM cte;
ALTER TABLE T2 RENAME TO T2_r4636;
UPDATE t1 SET a = a + 1 WHERE rowid = 1;
ALTER TABLE T RENAME COLUMN c TO c_r4979;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T WHERE c > 0);
CREATE TEMP  VIEW IF NOT EXISTS v_T2_3277 AS SELECT Y FROM T2;
UPDATE T2 SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
VACUUM;
ANALYZE T2;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_9212 ON T1(A COLLATE NOCASE);
INSERT OR FAIL INTO T VALUES ('', '', NULL);
WITH cte(x) AS (VALUES(NULL),(1),(NULL)) SELECT * FROM cte WHERE x IS NOT NULL;
REINDEX;
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 T2;

SELECT COUNT(*) FROM T2;
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA defer_foreign_keys = FALSE;
ATTACH DATABASE ':memory:' AS aux65;
.bail on
.lint
.dbconfig fk on
ATTACH DATABASE ':memory:' AS aux77;
-- max(1, 2, 3, 4, 5)

.headers on
PRAGMA automatic_index = NO;
PRAGMA automatic_index = YES;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',load_extension(NULL)), ('b',-jsonb_extract(exp(round(x'05e5de5c256042c731d3c19b9b', json_remove(json_quote(sign(1)), '$.key', '$[0]'))), '$')), ('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;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE `t1`(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d /* .dump main */ ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
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;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN /**/ SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
ALTER TABLE t1 RENAME TO t1_r1422;
SELECT COUNT(*) FROM T;
SELECT COUNT(*) FROM t1;
INSERT OR REPLACE INTO t1 VALUES (0, '', '', NULL);
SELECT * FROM T;
SELECT AVG(a) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT MAX(a) FROM T;
CREATE TRIGGER IF NOT EXISTS trg_T_9386 AFTER UPDATE OF b ON T BEGIN INSERT INTO T(b) VALUES (NULL); END;
INSERT INTO t1 VALUES (NULL, NULL, 1, 'x') ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
INSERT INTO T DEFAULT VALUES;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL), SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T;
DETACH DATABASE aux77;
DELETE FROM T WHERE rowid = 8 RETURNING *;
CREATE  INDEX IF NOT EXISTS idx_t1_6079 ON t1(a COLLATE NOCASE) WHERE a IS NOT NULL;
REINDEX t1;
ALTER TABLE T ADD COLUMN extra_3272 REAL;
ANALYZE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET b = b + 1 WHERE b IS NOT NULL RETURNING *;
SELECT * FROM t1 AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T1 (
  A VARCHAR(20) PRIMARY KEY,
  X VARCHAR(10) UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(20) PRIMARY KEY,
  Y VARCHAR(10) UNIQUE
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
INSERT INTO T2 VALUES ('c', 'l');
SELECT A FROM T1 INTERSECT SELECT A FROM T2;
ALTER TABLE T ADD COLUMN extra_595 ANY DEFAULT CURRENT_TIMESTAMP;
CREATE TRIGGER IF NOT EXISTS trg_T1_5859 BEFORE UPDATE OF X ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT SUM(a) FROM T;
DETACH DATABASE aux65;
ALTER TABLE T1 RENAME TO T1_r8707;
REINDEX T1;
PRAGMA fullsync = 1;
ALTER TABLE T2 ADD COLUMN extra_6787 ANY DEFAULT '';
INSERT INTO t1 DEFAULT VALUES;
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 T2;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T1 ADD COLUMN extra_1253 NONE;
VACUUM main;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
SELECT * FROM T1;
ALTER TABLE t1 DROP COLUMN d;
WITH cte(a, b) AS (VALUES(1, "a"),(2, "b"),(3, "c")) SELECT * FROM cte;
ALTER TABLE T2 RENAME TO T2_r4636;
UPDATE t1 SET a = a + 1 WHERE rowid = 1;
ALTER TABLE T RENAME COLUMN c TO c_r4979;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T WHERE c > 0);
CREATE TEMP  VIEW IF NOT EXISTS v_T2_3277 AS SELECT Y FROM T2;
UPDATE T2 SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
VACUUM;
ANALYZE T2;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_9212 ON T1(A COLLATE NOCASE);
INSERT OR FAIL INTO T VALUES ('', '', NULL);
WITH cte(x) AS (VALUES(NULL),(1),(NULL)) SELECT * FROM cte WHERE x IS NOT NULL;
REINDEX;
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 T2;

SELECT COUNT(*) FROM T2;
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;
PRAGMA defer_foreign_keys = FALSE;
ATTACH DATABASE ':memory:' AS aux65;
.bail on
.lint
.dbconfig fk on
ATTACH DATABASE ':memory:' AS aux77;
-- max(1, 2, 3, 4, 5)

.headers on
PRAGMA automatic_index = NO;
PRAGMA automatic_index = YES;
CREATE TABLE T (
  a TEXT,
  b REAL
);
INSERT INTO T VALUES ('a',load_extension(NULL)), ('b',-jsonb_extract(exp(round(x'05e5de5c256042c731d3c19b9b', json_remove(json_quote(sign(1)), '$.key', '$[0]'))), '$')), ('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;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE `t1`(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d /* .dump main */ ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
PRAGMA checkpoint_fullsync = FALSE;
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;
BEGIN EXCLUSIVE TRANSACTION;
ATTACH DATABASE ':memory:' AS aux85;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET d = 'x' WHERE d IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t1_5828 AFTER UPDATE OF d ON t1 BEGIN /**/ SELECT RAISE(FAIL, 'no'); END;
SELECT TOTAL(a) FROM t1;
PRAGMA mmap_size = 50000000;
DETACH DATABASE aux85;
SELECT * FROM t1 WHERE c > (SELECT AVG(c) FROM t1);
COMMIT TRANSACTION;
ALTER TABLE t1 RENAME TO t1_r4016;
INSERT INTO t1 DEFAULT VALUES;
ALTER TABLE t1 RENAME TO t1_r1422;
SELECT COUNT(*) FROM T;
SELECT COUNT(*) FROM t1;
INSERT OR REPLACE INTO t1 VALUES (0, '', '', NULL);
SELECT * FROM T;
SELECT AVG(a) OVER (PARTITION BY a ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM T;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
SELECT MAX(a) FROM T;
CREATE TRIGGER IF NOT EXISTS trg_T_9386 AFTER UPDATE OF b ON T BEGIN INSERT INTO T(b) VALUES (NULL); END;
INSERT INTO t1 VALUES (NULL, NULL, 1, 'x') ON CONFLICT(a) DO UPDATE SET a = excluded.a, b = excluded.b, c = excluded.c;
INSERT INTO T DEFAULT VALUES;
SELECT COUNT(*) FILTER (WHERE b IS NOT NULL), SUM(rowid) FILTER (WHERE b > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(b) FILTER (WHERE b > 0 AND b < 100), COUNT(*) FILTER (WHERE typeof(b) = "text") FROM T;
DETACH DATABASE aux77;
DELETE FROM T WHERE rowid = 8 RETURNING *;
CREATE  INDEX IF NOT EXISTS idx_t1_6079 ON t1(a COLLATE NOCASE) WHERE a IS NOT NULL;
REINDEX t1;
ALTER TABLE T ADD COLUMN extra_3272 REAL;
ANALYZE;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, 'Wernher', 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);
CREATE INDEX t1bc ON t1(b, c);
PRAGMA writable_schema = ON;
.imposter t1bc t2

SELECT * FROM t2;
SELECT b, c FROM t1 ORDER BY b, c;
.quit
UPDATE t1 SET b = b + 1 WHERE b IS NOT NULL RETURNING *;
SELECT * FROM t1 AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
CREATE TABLE T1 (
  A VARCHAR(20) PRIMARY KEY,
  X VARCHAR(10) UNIQUE
);
CREATE TABLE T2 (
  A VARCHAR(20) PRIMARY KEY,
  Y VARCHAR(10) UNIQUE
);
INSERT INTO T1 VALUES ('a', 'm');
INSERT INTO T1 VALUES ('b', 'n');
INSERT INTO T1 VALUES ('c', 'o');
INSERT INTO T2 VALUES ('b', 'k');
INSERT INTO T2 VALUES ('c', 'l');
SELECT A FROM T1 INTERSECT SELECT A FROM T2;
ALTER TABLE T ADD COLUMN extra_595 ANY DEFAULT CURRENT_TIMESTAMP;
CREATE TRIGGER IF NOT EXISTS trg_T1_5859 BEFORE UPDATE OF X ON T1 FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'rb'); END;
SELECT SUM(a) FROM T;
DETACH DATABASE aux65;
ALTER TABLE T1 RENAME TO T1_r8707;
REINDEX T1;
PRAGMA fullsync = 1;
ALTER TABLE T2 ADD COLUMN extra_6787 ANY DEFAULT '';
INSERT INTO t1 DEFAULT VALUES;
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 T2;
INSERT INTO T2 VALUES (NULL, NULL);
ALTER TABLE T1 ADD COLUMN extra_1253 NONE;
VACUUM main;
INSERT INTO t1 VALUES (NULL, NULL, NULL, NULL);
SELECT * FROM T1;
ALTER TABLE t1 DROP COLUMN d;
WITH cte(a, b) AS (VALUES(1, "a"),(2, "b"),(3, "c")) SELECT * FROM cte;
ALTER TABLE T2 RENAME TO T2_r4636;
UPDATE t1 SET a = a + 1 WHERE rowid = 1;
ALTER TABLE T RENAME COLUMN c TO c_r4979;
SELECT * FROM T WHERE EXISTS (SELECT 1 FROM T WHERE c > 0);
CREATE TEMP  VIEW IF NOT EXISTS v_T2_3277 AS SELECT Y FROM T2;
UPDATE T2 SET A = json_object('k', A) WHERE A BETWEEN 0 AND 100;
VACUUM;
ANALYZE T2;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_T1_9212 ON T1(A COLLATE NOCASE);
INSERT OR FAIL INTO T VALUES ('', '', NULL);
WITH cte(x) AS (VALUES(NULL),(1),(NULL)) SELECT * FROM cte WHERE x IS NOT NULL;
REINDEX;
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 T2;

SELECT COUNT(*) FROM T2;
INSERT INTO T DEFAULT VALUES;
SELECT LAG(a) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM t1;

ALTER TABLE T1 RENAME TO T1_r1135;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_T2_5766 AS SELECT A FROM T2;
ANALYZE t1;
ALTER TABLE T1 ADD COLUMN extra_1410 FLOA DEFAULT (abs(random()) % 1000);
```

## Actual output

```sql
Usage lint sub-command ?switches...?
Where sub-commands are:
    fkey-indexes
Error: unknown dbconfig "fk"
Enter ".dbconfig" with no arguments for a list
Parse error near line 16: no such function: jsonb_extract
  T INTO T VALUES ('a',load_extension(NULL)), ('b',-jsonb_extract(exp(round(x'05
                                      error here ---^
```

## Expectation

```sql

```

## Flag

```

```

