Files
ast-project/part1/results/3/bug_92b2481d-f7af-4e30-8a3a-a72d5328310f_logic.md
T
2026-06-24 13:47:14 +02:00

318 lines
13 KiB
Markdown

## Summary
<!--Explain briefly what goes wrong and explain why you believe this is a bug and not the intended behavior of SQLite (if it is not a crash).-->**No review yet**
## Minimized query
```sql
PRAGMA cell_size_check = 0;
.auth ON
CREATE TABLE T (
a INTEGER,
b TEXT,
c REAL
);
INSERT INTO T VALUES (-(-(tanh(-1859177127776019887))),'a',3.14), (1,'b',-7.75), (2,'c',-9e999);
SELECT b,a,c,
RANK() OVER (PARTITION BY a ORDER BY c DESC) AS d FROM T;
WITH cte AS (SELECT 1 AS x) SELECT x + 0.5 FROM cte;
INSERT INTO T DEFAULT VALUES;
SELECT * FROM T AS a RIGHT OUTER JOIN T AS b ON a.rowid = b.rowid;
CREATE TEMP VIEW IF NOT EXISTS v_T_9134 AS SELECT b FROM T;
SELECT LEAD(c, 0, 'default') OVER (ORDER BY c RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM T;
INSERT INTO T SELECT * FROM T;
WITH cte AS (SELECT c FROM T) SELECT * FROM cte;
ALTER TABLE T ADD COLUMN extra_1131 DATETIME COLLATE RTRIM;
ALTER TABLE T RENAME TO T_r227;
```
## Actual output
```sql
authorizer: INSERT "sqlite_master" NULL "main" NULL
authorizer: CREATE_TABLE "T" NULL "main" NULL
authorizer: UPDATE "sqlite_master" "type" "main" NULL
authorizer: UPDATE "sqlite_master" "name" "main" NULL
authorizer: UPDATE "sqlite_master" "tbl_name" "main" NULL
authorizer: UPDATE "sqlite_master" "rootpage" "main" NULL
authorizer: UPDATE "sqlite_master" "sql" "main" NULL
authorizer: READ "sqlite_master" "ROWID" "main" NULL
authorizer: INSERT "T" NULL "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: FUNCTION NULL "tanh" NULL NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: READ "T" "b" "main" NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: FUNCTION NULL "rank" NULL NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
a -1 3.14 1
b 1 -7.75 1
c 2 -Inf 1
authorizer: SELECT NULL NULL NULL NULL
authorizer: SELECT NULL NULL NULL "cte"
1.5
authorizer: INSERT "T" NULL "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "b" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "b" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: READ "T" "ROWID" "main" NULL
authorizer: READ "T" "ROWID" "main" NULL
-1 a 3.14 -1 a 3.14
1 b -7.75 1 b -7.75
2 c -Inf 2 c -Inf
authorizer: INSERT "sqlite_temp_master" NULL "temp" NULL
authorizer: CREATE_TEMP_VIEW "v_T_9134" NULL "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "type" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "name" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "tbl_name" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "rootpage" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "sql" "temp" NULL
authorizer: READ "sqlite_temp_master" "ROWID" "temp" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: FUNCTION NULL "lead" NULL NULL
authorizer: READ "T" "c" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
-Inf
-7.75
3.14
authorizer: INSERT "T" NULL "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "b" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: READ "T" "c" "main" "cte"
authorizer: SELECT NULL NULL NULL "cte"
3.14
-7.75
-Inf
3.14
-7.75
-Inf
authorizer: ALTER_TABLE "main" "T" NULL NULL
authorizer: FUNCTION NULL "printf" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: FUNCTION NULL "substr" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: FUNCTION NULL "length" NULL NULL
authorizer: FUNCTION NULL "printf" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: UPDATE "sqlite_master" "sql" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: ALTER_TABLE "main" "T" NULL NULL
authorizer: FUNCTION NULL "sqlite_rename_table" NULL NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: UPDATE "sqlite_master" "sql" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "tbl_name" "main" NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: UPDATE "sqlite_master" "tbl_name" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: FUNCTION NULL "substr" NULL NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: UPDATE "sqlite_master" "name" "main" NULL
authorizer: READ "sqlite_master" "tbl_name" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: FUNCTION NULL "sqlite_rename_table" NULL NULL
authorizer: READ "sqlite_temp_master" "type" "temp" NULL
authorizer: READ "sqlite_temp_master" "name" "temp" NULL
authorizer: READ "sqlite_temp_master" "sql" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "sql" "temp" NULL
authorizer: READ "sqlite_temp_master" "tbl_name" "temp" NULL
authorizer: FUNCTION NULL "sqlite_rename_test" NULL NULL
authorizer: READ "sqlite_temp_master" "sql" "temp" NULL
authorizer: READ "sqlite_temp_master" "type" "temp" NULL
authorizer: READ "sqlite_temp_master" "name" "temp" NULL
authorizer: READ "sqlite_temp_master" "tbl_name" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "tbl_name" "temp" NULL
authorizer: READ "sqlite_temp_master" "type" "temp" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: FUNCTION NULL "sqlite_rename_test" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_temp_master" "name" "temp" NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_temp_master" "sql" "temp" NULL
authorizer: FUNCTION NULL "sqlite_rename_test" NULL NULL
authorizer: READ "sqlite_temp_master" "sql" "temp" NULL
authorizer: READ "sqlite_temp_master" "type" "temp" NULL
authorizer: READ "sqlite_temp_master" "name" "temp" NULL
```
## Expectation
```sql
authorizer: INSERT "sqlite_master" NULL "main" NULL
authorizer: CREATE_TABLE "T" NULL "main" NULL
authorizer: UPDATE "sqlite_master" "type" "main" NULL
authorizer: UPDATE "sqlite_master" "name" "main" NULL
authorizer: UPDATE "sqlite_master" "tbl_name" "main" NULL
authorizer: UPDATE "sqlite_master" "rootpage" "main" NULL
authorizer: UPDATE "sqlite_master" "sql" "main" NULL
authorizer: READ "sqlite_master" "ROWID" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: FUNCTION NULL "tanh" NULL NULL
authorizer: INSERT "T" NULL "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: READ "T" "b" "main" NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: FUNCTION NULL "rank" NULL NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
a -1 3.14 1
b 1 -7.75 1
c 2 -Inf 1
authorizer: SELECT NULL NULL NULL NULL
authorizer: SELECT NULL NULL NULL "cte"
1.5
authorizer: INSERT "T" NULL "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "b" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "b" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: READ "T" "ROWID" "main" NULL
authorizer: READ "T" "ROWID" "main" NULL
-1 a 3.14 -1 a 3.14
1 b -7.75 1 b -7.75
2 c -Inf 2 c -Inf
authorizer: INSERT "sqlite_temp_master" NULL "temp" NULL
authorizer: CREATE_TEMP_VIEW "v_T_9134" NULL "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "type" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "name" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "tbl_name" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "rootpage" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "sql" "temp" NULL
authorizer: READ "sqlite_temp_master" "ROWID" "temp" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: FUNCTION NULL "lead" NULL NULL
authorizer: READ "T" "c" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
-Inf
-7.75
3.14
authorizer: INSERT "T" NULL "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: READ "T" "a" "main" NULL
authorizer: READ "T" "b" "main" NULL
authorizer: READ "T" "c" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: READ "T" "c" "main" "cte"
authorizer: SELECT NULL NULL NULL "cte"
3.14
-7.75
-Inf
3.14
-7.75
-Inf
authorizer: ALTER_TABLE "main" "T" NULL NULL
authorizer: FUNCTION NULL "printf" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: FUNCTION NULL "substr" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: FUNCTION NULL "length" NULL NULL
authorizer: FUNCTION NULL "printf" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: UPDATE "sqlite_master" "sql" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: ALTER_TABLE "main" "T" NULL NULL
authorizer: FUNCTION NULL "sqlite_rename_table" NULL NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: UPDATE "sqlite_master" "sql" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "tbl_name" "main" NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: UPDATE "sqlite_master" "tbl_name" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: FUNCTION NULL "substr" NULL NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: UPDATE "sqlite_master" "name" "main" NULL
authorizer: READ "sqlite_master" "tbl_name" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: FUNCTION NULL "sqlite_rename_table" NULL NULL
authorizer: READ "sqlite_temp_master" "type" "temp" NULL
authorizer: READ "sqlite_temp_master" "name" "temp" NULL
authorizer: READ "sqlite_temp_master" "sql" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "sql" "temp" NULL
authorizer: READ "sqlite_temp_master" "tbl_name" "temp" NULL
authorizer: FUNCTION NULL "sqlite_rename_test" NULL NULL
authorizer: READ "sqlite_temp_master" "sql" "temp" NULL
authorizer: READ "sqlite_temp_master" "type" "temp" NULL
authorizer: READ "sqlite_temp_master" "name" "temp" NULL
authorizer: READ "sqlite_temp_master" "tbl_name" "temp" NULL
authorizer: UPDATE "sqlite_temp_master" "tbl_name" "temp" NULL
authorizer: READ "sqlite_temp_master" "type" "temp" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: FUNCTION NULL "sqlite_rename_test" NULL NULL
authorizer: READ "sqlite_master" "sql" "main" NULL
authorizer: READ "sqlite_master" "type" "main" NULL
authorizer: READ "sqlite_master" "name" "main" NULL
authorizer: SELECT NULL NULL NULL NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_temp_master" "name" "temp" NULL
authorizer: FUNCTION NULL "like" NULL NULL
authorizer: READ "sqlite_temp_master" "sql" "temp" NULL
authorizer: FUNCTION NULL "sqlite_rename_test" NULL NULL
authorizer: READ "sqlite_temp_master" "sql" "temp" NULL
authorizer: READ "sqlite_temp_master" "type" "temp" NULL
authorizer: READ "sqlite_temp_master" "name" "temp" NULL
```
## Flag
```
-column
```