## 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
.once
CREATE TABLE T1 (
  A VARCHAR(-NULL),
  X VARCHAR(glob('*', 'hello')),
  PRIMARY KEY (A, X),
  UNIQUE (X)
);
-- PRAGMA read_uncommitted = 1;

CREATE TABLE "T2" (
  A VARCHAR(round(CAST(20 AS INTEGER), 2)),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;
.once
CREATE TABLE T1 (
  A VARCHAR(-1),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;
.once
CREATE TABLE T1 (
  A VARCHAR(-1),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;
.once
CREATE TABLE T1 (
  A VARCHAR(-1),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;
.once
CREATE TABLE T1 (
  A VARCHAR(-1),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;
.once
CREATE TABLE T1 (
  A VARCHAR(-1),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;
.once
CREATE TABLE T1 (
  A VARCHAR(-1),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;
.once
CREATE TABLE T1 (
  A VARCHAR(-1),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;
.once
CREATE TABLE T1 (
  A VARCHAR(-1),
  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;
SELECT * FROM T1 WHERE (X, X) IN (SELECT X, X FROM T1);

SELECT COUNT(*) FROM T2;
SELECT * FROM T1 AS a RIGHT OUTER JOIN T1 AS b ON a.rowid = b.rowid;
INSERT INTO T2 VALUES (NULL, NULL);
INSERT INTO T1 SELECT * FROM T1;
SELECT * FROM T1 WHERE A = (SELECT MAX(A) FROM T1 WHERE A = (SELECT MAX(A) FROM T1));
ALTER TABLE T1 DROP COLUMN X;
INSERT INTO T1 VALUES (NULL, NULL);
ALTER TABLE T2 RENAME TO T2_r5363;
ANALYZE T2;

DROP VIEW IF EXISTS T1;
SELECT * FROM T2;
ALTER TABLE T1 RENAME COLUMN X TO X_r5576;
WITH RECURSIVE fib(a,b,n) AS (VALUES(1,1,1) UNION ALL SELECT b, a+b, n+1 FROM fib WHERE n<19) SELECT a, n FROM fib;
ALTER TABLE T1 ADD COLUMN extra_6763 ANY COLLATE RTRIM;
ALTER TABLE T2 DROP COLUMN Y;
```

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

