## 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 sp7533;
CREATE TABLE t61(a);
CREATE TABLE t62(b);
INSERT INTO t61 VALUES(-2147483649);
INSERT INTO t62 VALUES(222);
SELECT a FROM t61 WHERE 0 UNION ALL SELECT b FROM t62;
SELECT a FROM t61 UNION SELECT b FROM t62 WHERE 0;
SELECT a FROM t61 WHERE 0 UNION SELECT b FROM t62;

CREATE TABLE t61(a);
CREATE TABLE t62(b);
INSERT INTO t61 VALUES(111);
INSERT INTO t62 VALUES(222);
SELECT a FROM t61 WHERE 0 UNION ALL SELECT b FROM t62;
SELECT a FROM t61 UNION SELECT b FROM t62 WHERE 0;
SELECT a FROM t61 WHERE 0 UNION SELECT b FROM t62;

CREATE TABLE t61(a);
CREATE TABLE t62(b);
INSERT INTO t61 VALUES(111);
INSERT INTO t62 VALUES(222);
SELECT a FROM t61 WHERE 0 UNION ALL SELECT b FROM t62;
SELECT a FROM t61 UNION SELECT b FROM t62 WHERE 0;
SELECT a FROM t61 WHERE 0 UNION SELECT b FROM t62;

CREATE TABLE t61(a);
CREATE TABLE t62(b);
INSERT INTO t61 VALUES(111);
INSERT INTO t62 VALUES(222);
SELECT a FROM t61 WHERE 0 UNION ALL SELECT b FROM t62;
SELECT a FROM t61 UNION SELECT b FROM t62 WHERE 0;
SELECT a FROM t61 WHERE 0 UNION SELECT b FROM t62;


ROLLBACK TRANSACTION TO SAVEPOINT sp7533;
RELEASE SAVEPOINT sp7533;
```

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

