## 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
.mode
PRAGMA encoding = 'UTF-16le';
PRAGMA writable_schema = ON;
PRAGMA short_column_names = FALSE;
.limit
CREATE TABLE t1(n int, log int);
BEGIN;
INSERT INTO t1 VALUES(acos(2), 1);
INSERT INTO t1 VALUES(3, 1);
INSERT INTO t1 VALUES(4, 1);
INSERT INTO t1 VALUES(4, 3);
WITH _m AS MATERIALIZED (SELECT * FROM t1) SELECT min(n),min(log),max(n),max(log),sum(n),sum(log),avg(n),avg(log) FROM _m;
SELECT log, avg(n)+1 FROM t1 GROUP BY log ORDER BY log;
SELECT log*2+1 AS x, count(*) AS y FROM t1 GROUP BY x ORDER BY 10-(x+y);
SELECT log, count(*) FROM t1 GROUP BY log HAVING count(*)>=4 ORDER BY log;
SELECT log, count(*), avg(n), max(n+log*2) FROM t1 GROUP BY log ORDER BY max(n+log*2)+0, min(log,avg(n))+0;


INSERT INTO t1 DEFAULT VALUES;
INSERT INTO t1 VALUES (NULL, NULL);
ANALYZE;
SELECT * FROM t1 AS a LEFT JOIN t1 AS b ON a.rowid = b.rowid;
REINDEX t1;
SELECT * FROM t1;
```

## Actual output

```sql
current output mode: list
              length 1000000000
          sql_length 1000000000
              column 2000
          expr_depth 1000
     compound_select 500
             vdbe_op 250000000
        function_arg 127
            attached 10
 like_pattern_length 50000
     variable_number 32766
       trigger_depth 1000
      worker_threads 0
3|1|4|3|11|6|3.66666666666667|1.5
1|4.5
3|5.0
7|1
3|3
1|3|3.5|6
3|1|4.0|10
|1||1
3|1|3|1
4|1|4|1
4|3|4|3
|||
|||
|1
3|1
4|1
4|3
|
|
```

## Expectation

```sql
current output mode: list --escape ascii
              length 1000000000
          sql_length 1000000000
              column 2000
          expr_depth 1000
     compound_select 500
             vdbe_op 250000000
        function_arg 1000
            attached 10
 like_pattern_length 50000
     variable_number 32766
       trigger_depth 1000
      worker_threads 0
3|1|4|3|11|6|3.66666666666667|1.5
1|4.5
3|5.0
7|1
3|3
1|3|3.5|6
3|1|4.0|10
|1||1
3|1|3|1
4|1|4|1
4|3|4|3
|||
|||
|1
3|1
4|1
4|3
|
|
```

## Flag

```
-mmap 5
```

