## Summary
<!--Explain briefly what goes wrong and explain why you believe this is a bug and not the intended behavior of SQLite (if it is not a crash).-->**No review yet**

## Minimized query

```sql
ATTACH DATABASE ':memory:' AS aux49;
CREATE TABLE aa(a);
CREATE TABLE bb(b);
INSERT INTO aa VALUES(json_valid(1, 2));
INSERT INTO aa VALUES(3);
INSERT INTO bb VALUES(2);
INSERT INTO bb VALUES(4);
SELECT * FROM aa, bb WHERE max(a,b)>2;
INSERT INTO bb VALUES(0);
SELECT * FROM aa CROSS JOIN bb WHERE b;
SELECT * FROM aa, bb WHERE NOT min(a,b);
SELECT * FROM aa, bb WHERE CASE WHEN a=b-1 THEN 0 ELSE 1 END;

DELETE FROM bb WHERE b IS NULL RETURNING *;
CREATE TABLE T1 (
  A VARCHAR(10) PRIMARY KEY,
  B VARCHAR(15) UNIQUE,
  C CHAR(10)
);
CREATE TABLE main.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 T2.A = T1.A AND T1.C >= 0;
INSERT OR REPLACE INTO aa VALUES (NULL);
INSERT INTO bb VALUES (NULL);

SELECT COUNT(*) FROM bb;
DETACH DATABASE aux49;
SELECT * FROM T1 AS a RIGHT OUTER JOIN aa AS b ON a.rowid = b.rowid;
DELETE FROM T2 WHERE rowid = 30;
INSERT INTO T1 VALUES (NULL, NULL, NULL);
```

## Actual output

```sql
3|2
3|4
3|2
3|4
3|0
3|2
3|0
n|q|2147483647
4
a|p|-2147483648|3
b|q|2147483647|
```

## Expectation

```sql

```

## Flag

```

```

