## 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
PRAGMA wal_checkpoint('PASSIVE');
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
-- -nullvalue "NU11"

INSERT INTO T VALUES (1,2.0,10.5), (1,-3.5,20.25), (2,9e999,-1.0);
WITH d AS (SELECT a,SUM(b*c) AS e FROM T GROUP BY a) SELECT * FROM d;
BEGIN EXCLUSIVE;
ATTACH DATABASE ':memory:' AS aux19;
CREATE TABLE t1(a DATETIME PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (substr(ceiling((-(-(1)) * 1)), 100), ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;

UPDATE T SET b = json_object('k', b) WHERE 1;
UPDATE t2 SET b = 'x' WHERE b BETWEEN 0 AND 100;
CREATE  VIEW IF NOT EXISTS v_t2_1374 AS SELECT a FROM t2;
SELECT * FROM (SELECT * FROM t2) AS t1 JOIN (SELECT * FROM t2) AS t2 ON t1.b = t2.b;
SELECT GROUP_CONCAT(x) FROM t920;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t2_2418 ON t2(lower(a)) WHERE a IS NOT NULL;
CREATE TABLE t1(a DATETIME PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (substr(1, 100), ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;

UPDATE T SET b = json_object('k', b) WHERE 1;
UPDATE t2 SET b = 'x' WHERE b BETWEEN 0 AND 100;
CREATE  VIEW IF NOT EXISTS v_t2_1374 AS SELECT a FROM t2;
SELECT * FROM (SELECT * FROM t2) AS t1 JOIN (SELECT * FROM t2) AS t2 ON t1.b = t2.b;
SELECT GROUP_CONCAT(x) FROM t920;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t2_2418 ON t2(lower(a)) WHERE a IS NOT NULL;
CREATE TABLE t1(a DATETIME PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (substr(1, 100), ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;

UPDATE T SET b = json_object('k', b) WHERE 1;
UPDATE t2 SET b = 'x' WHERE b BETWEEN 0 AND 100;
CREATE  VIEW IF NOT EXISTS v_t2_1374 AS SELECT a FROM t2;
SELECT * FROM (SELECT * FROM t2) AS t1 JOIN (SELECT * FROM t2) AS t2 ON t1.b = t2.b;
SELECT GROUP_CONCAT(x) FROM t920;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t2_2418 ON t2(lower(a)) WHERE a IS NOT NULL;
CREATE TABLE t1(a DATETIME PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (substr(1, 100), ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;

UPDATE T SET b = json_object('k', b) WHERE 1;
UPDATE t2 SET b = 'x' WHERE b BETWEEN 0 AND 100;
CREATE  VIEW IF NOT EXISTS v_t2_1374 AS SELECT a FROM t2;
SELECT * FROM (SELECT * FROM t2) AS t1 JOIN (SELECT * FROM t2) AS t2 ON t1.b = t2.b;
SELECT GROUP_CONCAT(x) FROM t920;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t2_2418 ON t2(lower(a)) WHERE a IS NOT NULL;
CREATE TABLE t1(a DATETIME PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (substr(1, 100), ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT, d INT);
INSERT INTO t1 VALUES (1, ('Wernher' || ''), 10, 100);
INSERT INTO t1 VALUES (2, 'von', 20, 200);
INSERT INTO t1 VALUES (3, 'Braun', 30, 300);

CREATE INDEX t1bc ON t1(b, c);

PRAGMA writable_schema = ON;

.imposter t1bc t2

SELECT * FROM t2;

SELECT b, c FROM t1 ORDER BY b, c;

.quit
SAVEPOINT sp5525;
-- changes()

PRAGMA compile_options;
CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
CREATE TABLE t2(a, b);
CREATE TABLE T (
  a TEXT,
  b TEXT,
  c REAL
);
INSERT INTO T VALUES ('a','b','-'), ('a','c',-1222056731234344303), ('b','b',4.75);
SELECT a,
SUM(CASE WHEN b!='b' THEN c ELSE 0 END) AS d,
SUM(CASE WHEN b='c' THEN c ELSE 0 END) AS e
FROM T
GROUP BY a;
CREATE VIEW agg2 AS SELECT a, sum(b) AS m FROM t2 GROUP BY a;
SELECT t1.z, agg2.m FROM t1 JOIN agg2 ON t1.y==agg2.m WHERE NOT NOT (t1.x IN (1,2,3)) ;
CREATE TABLE t920(x);
INSERT INTO t920 VALUES(3),(4),(5);
SELECT * FROM t920,(SELECT 0 FROM t920),(VALUES(9)) WHERE 5 IN (x);
PRAGMA fullsync = 0;
CREATE  INDEX IF NOT EXISTS idx_t2_788 ON t2(lower(a)) WHERE +a > 0;
ALTER TABLE t1 RENAME COLUMN y TO y_r8132;
DELETE FROM t920 WHERE +x > (SELECT AVG(x) FROM t920) RETURNING *;
SELECT * FROM t2;
ALTER TABLE t920 ADD COLUMN extra_3469 NCHAR(55) DEFAULT 0;
SELECT * FROM T;
SELECT AVG(b) FROM t2;
DELETE FROM t2 WHERE +a > (SELECT AVG(a) FROM t2);
RELEASE sp5525;
SELECT * FROM (SELECT * FROM t1) AS sub;
SELECT a, (SELECT MAX(a) FROM t2) AS max_val FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t920 SELECT * FROM t920;

UPDATE T SET b = json_object('k', b) WHERE 1;
UPDATE t2 SET b = 'x' WHERE b BETWEEN 0 AND 100;
CREATE  VIEW IF NOT EXISTS v_t2_1374 AS SELECT a FROM t2;
SELECT * FROM (SELECT * FROM t2) AS t1 JOIN (SELECT * FROM t2) AS t2 ON t1.b = t2.b;
SELECT GROUP_CONCAT(x) FROM t920;
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t2_2418 ON t2(lower(a)) WHERE a IS NOT NULL;

UPDATE T SET a = CURRENT_TIMESTAMP;
ALTER TABLE t920 RENAME TO t920_r7385;
WITH a AS (SELECT x FROM t1), b AS (SELECT COUNT(*) AS cnt FROM a) SELECT * FROM b;
INSERT OR ABORT INTO t2 VALUES (0, 0);
WITH cte AS (SELECT z, LAG(z) OVER (ORDER BY z) AS prev FROM t1) SELECT * FROM cte;
CREATE  INDEX IF NOT EXISTS idx_t1_5378 ON t1((z + 1)) WHERE z > 0;
SELECT * FROM T;
UPDATE t1 SET x = json_object('k', x) WHERE rowid = 1 RETURNING *;
REINDEX;
INSERT INTO t920 VALUES (1) ON CONFLICT(x) DO UPDATE SET x = excluded.x;
DETACH DATABASE aux19;
ALTER TABLE t2 RENAME COLUMN b TO b_r9054;
COMMIT TRANSACTION;
INSERT OR FAIL INTO t1 VALUES ('x', 'x', NULL);
CREATE TRIGGER IF NOT EXISTS trg_t2_1866 AFTER UPDATE ON t2 BEGIN SELECT RAISE(FAIL, 'no'); END;
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 T;
ALTER TABLE t2 ADD COLUMN extra_9820 DOUBLE PRECISION DEFAULT (abs(random()) % 1000);
REINDEX;
PRAGMA temp_store = '0';
CREATE UNIQUE  INDEX IF NOT EXISTS idx_t1_6930 ON t1(z) WHERE z IS NOT NULL;
CREATE TRIGGER IF NOT EXISTS trg_t920_9649 AFTER INSERT ON t920 FOR EACH ROW BEGIN SELECT RAISE(FAIL, 'no'); END;
SELECT MAX(x) OVER (ORDER BY x ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t920;
ALTER TABLE t920 RENAME TO t920_r9094;
```

## Actual output

```sql
0|-1|-1
1|-49.875
2|-Inf
CREATE TABLE "t2"("b","c","_ROWID_",PRIMARY KEY("b","c","_ROWID_"))WITHOUT ROWID;
WARNING: writing to an imposter table will corrupt the "t1bc" index!
Braun|30|3
Wernher|10|1
von|20|2
Braun|30
Wernher|10
von|20
```

## Expectation

```sql
0|-1|-1
1|-49.875
2|-Inf
CREATE TABLE "t2"("b","c","_ROWID_",PRIMARY KEY("b","c","_ROWID_"))WITHOUT ROWID;
Braun|30|3
Wernher|10|1
von|20|2
Braun|30
Wernher|10
von|20
```

## Flag

```

```

