## 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
.dbconfig
PRAGMA defer_foreign_keys = TRUE;
.exit
((PRAGMA)) writable_schema = OFF;
.archive
.progress tanh(-(-(lower(('你好' || '')))))
.open employee.db
PRAGMA secure_delete = ('FAST' || '');
.indexes
ATTACH DATABASE ':memory:' AS aux31;
DROP TABLE IF EXISTS tx;
CREATE TABLE tx(id DECIMAL(NULL,5) PRIMARY KEY, a, b);
INSERT INTO tx(a,b) VALUES(unixepoch(x'dd20da'),(456 + 0.0));
INSERT INTO tx(a,b) VALUES(33,789);
SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE NOT NOT (t0.a=t1.a AND t1.a=33 AND t0.b=456 UNION SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=789) ORDER BY 1;
DELETE FROM tx WHERE id > (SELECT AVG(id) FROM tx);
DETACH DATABASE aux31;
SELECT * FROM tx;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_tx_765 AS WITH _m AS MATERIALIZED (SELECT * FROM T2) SELECT id FROM tx;
REINDEX tx;
DELETE FROM tx WHERE 1;
INSERT OR FAIL INTO tx VALUES (5, NULL, NULL);
REINDEX;
CREATE TABLE T1 (
  A VARCHAR(20),
  X VARCHAR(10),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
CREATE TABLE _m (
  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;
PRAGMA vdbe_debug = YES;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<98) SELECT * FROM cnt;
SELECT * FROM T1 AS a LEFT JOIN tx AS b ON a.rowid = b.rowid;
INSERT OR ABORT INTO tx VALUES (NULL, NULL, '');
DROP TABLE IF EXISTS tx;
.open employee.db
PRAGMA secure_delete = 'FAST';
.indexes
ATTACH DATABASE ':memory:' AS aux31;
DROP TABLE IF EXISTS tx;
CREATE TABLE tx(id INTEGER PRIMARY KEY, a, b);
INSERT INTO tx(a,b) VALUES(unixepoch(x'dd20da'),(456 + 0.0));
INSERT INTO tx(a,b) VALUES(33,789);
SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=456 UNION SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=789 ORDER BY 1;
DELETE FROM tx WHERE id > (SELECT AVG(id) FROM tx);
DETACH DATABASE aux31;
SELECT * FROM tx;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_tx_765 AS SELECT id FROM tx;
REINDEX tx;
DELETE FROM tx WHERE 1;
INSERT OR FAIL INTO tx VALUES (5, NULL, NULL);
REINDEX;
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;
PRAGMA vdbe_debug = YES;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<98) SELECT * FROM cnt;
SELECT * FROM T1 AS a LEFT JOIN tx AS b ON a.rowid = b.rowid;
INSERT OR ABORT INTO tx VALUES (NULL, NULL, '');
DROP TABLE IF EXISTS tx;
.open employee.db
PRAGMA secure_delete = 'FAST';
.indexes
ATTACH DATABASE ':memory:' AS aux31;
DROP TABLE IF EXISTS tx;
CREATE TABLE tx(id INTEGER PRIMARY KEY, a, b);
INSERT INTO tx(a,b) VALUES(unixepoch(x'dd20da'),(456 + 0.0));
INSERT INTO tx(a,b) VALUES(33,789);
SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=456 UNION SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=789 ORDER BY 1;
DELETE FROM tx WHERE id > (SELECT AVG(id) FROM tx);
DETACH DATABASE aux31;
SELECT * FROM tx;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_tx_765 AS SELECT id FROM tx;
REINDEX tx;
DELETE FROM tx WHERE 1;
INSERT OR FAIL INTO tx VALUES (5, NULL, NULL);
REINDEX;
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;
PRAGMA vdbe_debug = YES;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<98) SELECT * FROM cnt;
SELECT * FROM T1 AS a LEFT JOIN tx AS b ON a.rowid = b.rowid;
INSERT OR ABORT INTO tx VALUES (NULL, NULL, '');
DROP TABLE IF EXISTS tx;
.open employee.db
PRAGMA secure_delete = 'FAST';
.indexes
ATTACH DATABASE ':memory:' AS aux31;
DROP TABLE IF EXISTS tx;
CREATE TABLE tx(id INTEGER PRIMARY KEY, a, b);
INSERT INTO tx(a,b) VALUES(unixepoch(x'dd20da'),(456 + 0.0));
INSERT INTO tx(a,b) VALUES(33,789);
SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=456 UNION SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=789 ORDER BY 1;
DELETE FROM tx WHERE id > (SELECT AVG(id) FROM tx);
DETACH DATABASE aux31;
SELECT * FROM tx;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_tx_765 AS SELECT id FROM tx;
REINDEX tx;
DELETE FROM tx WHERE 1;
INSERT OR FAIL INTO tx VALUES (5, NULL, NULL);
REINDEX;
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;
PRAGMA vdbe_debug = YES;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<98) SELECT * FROM cnt;
SELECT * FROM T1 AS a LEFT JOIN tx AS b ON a.rowid = b.rowid;
INSERT OR ABORT INTO tx VALUES (NULL, NULL, '');
DROP TABLE IF EXISTS tx;
.open employee.db
PRAGMA secure_delete = 'FAST';
.indexes
ATTACH DATABASE ':memory:' AS aux31;
DROP TABLE IF EXISTS tx;
CREATE TABLE tx(id INTEGER PRIMARY KEY, a, b);
INSERT INTO tx(a,b) VALUES(unixepoch(x'dd20da'),(456 + 0.0));
INSERT INTO tx(a,b) VALUES(33,789);
SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=456 UNION SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=789 ORDER BY 1;
DELETE FROM tx WHERE id > (SELECT AVG(id) FROM tx);
DETACH DATABASE aux31;
SELECT * FROM tx;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_tx_765 AS SELECT id FROM tx;
REINDEX tx;
DELETE FROM tx WHERE 1;
INSERT OR FAIL INTO tx VALUES (5, NULL, NULL);
REINDEX;
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;
PRAGMA vdbe_debug = YES;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<98) SELECT * FROM cnt;
SELECT * FROM T1 AS a LEFT JOIN tx AS b ON a.rowid = b.rowid;
INSERT OR ABORT INTO tx VALUES (NULL, NULL, '');
DROP TABLE IF EXISTS tx;
.open employee.db
PRAGMA secure_delete = 'FAST';
.indexes
ATTACH DATABASE ':memory:' AS aux31;
DROP TABLE IF EXISTS tx;
CREATE TABLE tx(id INTEGER PRIMARY KEY, a, b);
INSERT INTO tx(a,b) VALUES(unixepoch(x'dd20da'),(456 + 0.0));
INSERT INTO tx(a,b) VALUES(33,789);
SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=456 UNION SELECT DISTINCT t0.id, t0.a, t0.b FROM tx AS t0, tx AS t1 WHERE t0.a=t1.a AND t1.a=33 AND t0.b=789 ORDER BY 1;
DELETE FROM tx WHERE id > (SELECT AVG(id) FROM tx);
DETACH DATABASE aux31;
SELECT * FROM tx;
CREATE TEMPORARY  VIEW IF NOT EXISTS v_tx_765 AS SELECT id FROM tx;
REINDEX tx;
DELETE FROM tx WHERE 1;
INSERT OR FAIL INTO tx VALUES (5, NULL, NULL);
REINDEX;
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;
PRAGMA vdbe_debug = YES;
WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<98) SELECT * FROM cnt;
SELECT * FROM T1 AS a LEFT JOIN tx AS b ON a.rowid = b.rowid;
INSERT OR ABORT INTO tx VALUES (NULL, NULL, '');
DROP TABLE IF EXISTS tx;
INSERT INTO tx VALUES (NULL, 'x', NULL) ON CONFLICT(id) DO UPDATE SET id = excluded.id, a = excluded.a, b = excluded.b;
ALTER TABLE T1 DROP COLUMN A;
REINDEX;
WITH cte AS (SELECT "123" AS x) SELECT x + 0 FROM cte;
DELETE FROM T1 WHERE A > (SELECT AVG(A) FROM T1) RETURNING *;
SELECT * FROM T1;
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 tx;
UPDATE T2 SET Y = 'x' WHERE Y BETWEEN 0 AND 100;
ANALYZE _m;
CREATE TABLE T1 (
  a INTEGER,
  b TEXT
);
CREATE TABLE T2 (
  a INTEGER,
  b TEXT
);
INSERT INTO T1 VALUES (1,'a'),(2,'b');
INSERT INTO T2 VALUES (1,'c'),(1,'d');
SELECT T1.b,
(
  SELECT GROUP_CONCAT(b,',')
  FROM T2
  WHERE T2.a=T1.a
) AS c
FROM T1;
CREATE TABLE T (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) NOT NULL,
  C DOUBLE PRECISION
);
INSERT INTO T VALUES ('a', 'p', -1.7976931348623157e+308);
INSERT INTO T VALUES ('b', 'q', -0.000000001);
INSERT INTO T VALUES ('c', 'r', 0.0);
INSERT INTO T VALUES ('d', 's', 3.14159265358979);
INSERT INTO T VALUES ('e', 't', 1.7976931348623157e+308);
INSERT INTO T VALUES ('f', 't', 750.25);
SELECT B, AVG(C) AS D, MIN(C) AS E, MAX(C) AS F FROM T GROUP BY B;
PRAGMA temp_store = '1';
DROP VIEW IF EXISTS _m;
INSERT INTO T2 DEFAULT VALUES;
SELECT COUNT(*) FILTER (WHERE id IS NOT NULL), SUM(rowid) FILTER (WHERE id > 0), COUNT(*) FILTER (WHERE 1=0), COUNT(*) FILTER (WHERE 1=1), COUNT(*) FILTER (WHERE NULL), AVG(id) FILTER (WHERE id > 0 AND id < 100), COUNT(*) FILTER (WHERE typeof(id) = "text") FROM tx;
SELECT LAG(a) OVER (ORDER BY a ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE GROUP) FROM tx;
DROP INDEX IF EXISTS tx;
ALTER TABLE T1 DROP COLUMN a;
SELECT SUM(id) FROM tx;
CREATE TEMP  VIEW IF NOT EXISTS v_T1_489 AS SELECT b FROM T1;
WITH a AS MATERIALIZED (SELECT * FROM T1), b AS NOT MATERIALIZED (SELECT * FROM a) SELECT * FROM b;
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 T1;
ALTER TABLE T1 ADD COLUMN extra_1809 FLOAT DEFAULT 0;
INSERT INTO _m VALUES (NULL, NULL);
SELECT * FROM tx AS a RIGHT JOIN T1 AS b ON a.rowid = b.rowid;
ALTER TABLE tx DROP COLUMN id;
CREATE TRIGGER IF NOT EXISTS trg_T2_1178 BEFORE DELETE ON T2 FOR EACH ROW BEGIN SELECT RAISE(ABORT, 'abort'); END;
SELECT COUNT(*) FILTER (WHERE Y > 0) OVER (PARTITION BY Y ORDER BY Y ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES) FROM _m;
```

## Actual output

```sql
defensive off
            dqs_ddl on
            dqs_dml on
        enable_fkey off
        enable_qpsg off
     enable_trigger on
        enable_view on
     fts3_tokenizer off
 legacy_alter_table off
 legacy_file_format off
     load_extension on
   no_ckpt_on_close off
     reset_database off
        trigger_eqp off
     trusted_schema on
    writable_schema off
```

## Expectation

```sql
attach_create on
       attach_write on
           comments on
          defensive on
            dqs_ddl off
            dqs_dml off
        enable_fkey off
        enable_qpsg off
     enable_trigger on
        enable_view on
     fts3_tokenizer off
 legacy_alter_table off
 legacy_file_format off
     load_extension on
   no_ckpt_on_close off
     reset_database off
  reverse_scanorder off
    stmt_scanstatus off
        trigger_eqp off
     trusted_schema off
    writable_schema off
```

## Flag

```

```

