## 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
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(2147483648) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;

.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;

.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;

.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;

.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;

.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;

.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;

.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
.check
ATTACH DATABASE ':memory:' AS aux58;
CREATE TABLE T (
  A VARCHAR(concat_ws('', 'a', 'b', 'c')) PRIMARY KEY,
  B VARCHAR(30) NOT NULL,
  C BIGINT UNIQUE
);
INSERT INTO T VALUES ('a', 'x', -9223372036854775808);
INSERT INTO T VALUES ('b', 'y', -1000000);
INSERT INTO T VALUES ('c', 'y', 0);
INSERT INTO T VALUES ('d', 'y', 42);
INSERT INTO T VALUES ('e', 'x', 9223372036854775807);
INSERT INTO T VALUES ('f', 'z', 2147483648);
SELECT * FROM T WHERE +C > 0 ORDER BY C DESC;
ATTACH DATABASE ':memory:' AS aux82;
PRAGMA trusted_schema = YES;
PRAGMA vdbe_listing = TRUE;
PRAGMA read_uncommitted = TRUE;
.open random-json.db
CREATE TABLE t1(a UNSIGNED BIG INT PRIMARY KEY, b);
CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
INSERT INTO t1 VALUES('-Inf','apple'),(json_array(2, 2),'fig'),(3,'pear');
INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5);
CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN
  DELETE FROM t2 wHeRe id = OLD.a;
END;
ALTER TABLE t1 RENAME TO t3;
UPDATE t3 SET b='peach' WHERE a=2;

DETACH DATABASE aux82;
INSERT INTO t1 SELECT * FROM t1;
SELECT LAG(a, a) OVER (ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t1;
SELECT * FROM t1;
DETACH DATABASE aux58;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;


ALTER TABLE t1 DROP COLUMN b;
REINDEX t1;
VACUUM main;
```

## Actual output

```sql
Usage: /home/test/sqlite3-src/build/sqlite3 [OPTIONS] FILENAME [SQL]
FILENAME is the name of an SQLite database. A new database is created
if the file does not previously exist.
OPTIONS include:
   -append              append the database to the end of the file
   -ascii               set output mode to 'ascii'
   -bail                stop after hitting an error
   -batch               force batch I/O
   -box                 set output mode to 'box'
   -column              set output mode to 'column'
   -cmd COMMAND         run "COMMAND" before reading stdin
   -csv                 set output mode to 'csv'
   -deserialize         open the database using sqlite3_deserialize()
   -echo                print commands before execution
   -init FILENAME       read/process named file
   -[no]header          turn headers on or off
   -help                show this message
   -html                set output mode to HTML
   -interactive         force interactive I/O
   -json                set output mode to 'json'
   -line                set output mode to 'line'
   -list                set output mode to 'list'
   -lookaside SIZE N    use N entries of SZ bytes for lookaside memory
   -markdown            set output mode to 'markdown'
   -maxsize N           maximum size for a --deserialize database
   -memtrace            trace all memory allocations and deallocations
   -mmap N              default mmap size set to N
   -newline SEP         set output row separator. Default: '\n'
   -nofollow            refuse to open symbolic links to database files
   -nonce STRING        set the safe-mode escape nonce
   -nullvalue TEXT      set text string for NULL values. Default ''
   -pagecache SIZE N    use N slots of SZ bytes each for page cache memory
   -quote               set output mode to 'quote'
   -readonly            open the database read-only
   -safe                enable safe-mode
   -separator SEP       set output column separator. Default: '|'
   -stats               print memory stats before each finalize
   -table               set output mode to 'table'
   -tabs                set output mode to 'tabs'
   -version             show SQLite version
   -vfs NAME            use NAME as the default VFS
```

## Expectation

```sql

```

## Flag

```
-help
```

