Files
ast-project/part1/results/2/bug_ba70db24-605e-4f43-869e-361dac61f7ab_logic.md
2026-06-24 13:47:14 +02:00

445 lines
12 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 function_list;
PRAGMA foreign_keys = FALSE;
PRAGMA secure_delete;
.fullschema
BEGIN;
create TABLE abc(a, b, c, PRIMARY KEY(a, b));
INSERT INTO abc VALUES((2147483646 * 1), 1, 1);
INSERT INTO abc SELECT a+(select max(a) FROM abc), b+(select max(a) FROM abc), c+(select max(a) FROM abc) FROM abc;
COMMIT;
SELECT count((SELECT a FROM abc WHERE a = NULL AND b >= upper.c)) FROM abc AS upper;
SELECT * FROM sqlite_master WHERE rowid=10;
SELECT MAX(b) FROM abc;
```
## Actual output
```sql
pow,1,s,utf8,2,2099200
group_concat,1,w,utf8,1,2097152
group_concat,1,w,utf8,2,2097152
json_type,1,s,utf8,1,2048
json_type,1,s,utf8,2,2048
julianday,1,s,utf8,-1,2099200
ntile,1,w,utf8,1,2097152
nullif,1,s,utf8,2,2099200
sqlite_compileoption_get,1,s,utf8,1,2097152
json_valid,1,s,utf8,1,2048
json_quote,1,s,utf8,1,2048
json_patch,1,s,utf8,2,2048
->,1,s,utf8,2,2048
json_array,1,s,utf8,-1,2048
current_timestamp,1,s,utf8,0,2097152
power,1,s,utf8,2,2099200
sqlite_compileoption_used,1,s,utf8,1,2097152
json_remove,1,s,utf8,-1,2048
json_object,1,s,utf8,-1,2048
json_insert,1,s,utf8,-1,2048
->>,1,s,utf8,2,2048
sin,1,s,utf8,1,2099200
sum,1,w,utf8,1,2097152
quote,1,s,utf8,1,2099200
printf,1,s,utf8,-1,2099200
likelihood,1,s,utf8,2,2099200
json_replace,1,s,utf8,-1,2048
json_extract,1,s,utf8,-1,2048
last_value,1,w,utf8,1,2097152
rank,1,w,utf8,0,2097152
sign,1,s,utf8,1,2099200
sqrt,1,s,utf8,1,2099200
sinh,1,s,utf8,1,2099200
tan,1,s,utf8,1,2099200
round,1,s,utf8,1,2099200
round,1,s,utf8,2,2099200
rtrim,1,s,utf8,1,2099200
rtrim,1,s,utf8,2,2099200
nth_value,1,w,utf8,2,2097152
tanh,1,s,utf8,1,2099200
random,1,s,utf8,0,2097152
trim,1,s,utf8,1,2099200
trim,1,s,utf8,2,2099200
time,1,s,utf8,-1,2099200
radians,1,s,utf8,1,2099200
trunc,1,s,utf8,1,2099200
total,1,w,utf8,1,2097152
substr,1,s,utf8,2,2099200
substr,1,s,utf8,3,2099200
replace,1,s,utf8,3,2099200
upper,1,s,utf8,1,2099200
subtype,1,s,utf8,1,2099200
typeof,1,s,utf8,1,2099200
load_extension,1,s,utf8,1,524288
load_extension,1,s,utf8,2,524288
json_group_array,1,w,utf8,1,1050624
avg,1,w,utf8,1,2097152
abs,1,s,utf8,1,2099200
json_group_object,1,w,utf8,2,1050624
json_array_length,1,s,utf8,1,2048
json_array_length,1,s,utf8,2,2048
strftime,1,s,utf8,-1,2099200
atan,1,s,utf8,1,2099200
asin,1,s,utf8,1,2099200
acos,1,s,utf8,1,2099200
unknown,1,s,utf8,-1,2099200
substring,1,s,utf8,2,2099200
substring,1,s,utf8,3,2099200
randomblob,1,s,utf8,1,2097152
unicode,1,s,utf8,1,2099200
percent_rank,1,w,utf8,0,2097152
row_number,1,w,utf8,0,2097152
atanh,1,s,utf8,1,2099200
asinh,1,s,utf8,1,2099200
acosh,1,s,utf8,1,2099200
cos,1,s,utf8,1,2099200
atan2,1,s,utf8,2,2099200
last_insert_rowid,1,s,utf8,0,2097152
sqlite_log,1,s,utf8,2,2099200
unlikely,1,s,utf8,1,2099200
cosh,1,s,utf8,1,2099200
ceil,1,s,utf8,1,2099200
char,1,s,utf8,-1,2099200
unixepoch,1,s,utf8,-1,2099200
exp,1,s,utf8,1,2099200
count,1,w,utf8,0,2097152
count,1,w,utf8,1,2097152
date,1,s,utf8,-1,2099200
sqlite_offset,1,s,utf8,1,2097152
ceiling,1,s,utf8,1,2099200
total_changes,1,s,utf8,0,2097152
changes,1,s,utf8,0,2097152
sqlite_version,1,s,utf8,0,2097152
degrees,1,s,utf8,1,2099200
floor,1,s,utf8,1,2099200
coalesce,1,s,utf8,-1,2099200
glob,1,s,utf8,2,2099200
zeroblob,1,s,utf8,1,2099200
hex,1,s,utf8,1,2099200
iif,1,s,utf8,3,2099200
sqlite_source_id,1,s,utf8,0,2097152
format,1,s,utf8,-1,2099200
datetime,1,s,utf8,-1,2099200
cume_dist,1,w,utf8,0,2097152
ln,1,s,utf8,1,2099200
instr,1,s,utf8,2,2099200
json,1,s,utf8,1,2048
dense_rank,1,w,utf8,0,2097152
log,1,s,utf8,1,2099200
log,1,s,utf8,2,2099200
ifnull,1,s,utf8,2,2099200
current_date,1,s,utf8,0,2097152
current_time,1,s,utf8,0,2097152
lag,1,w,utf8,1,2097152
lag,1,w,utf8,3,2097152
lag,1,w,utf8,2,2097152
mod,1,s,utf8,2,2099200
log2,1,s,utf8,1,2099200
like,1,s,utf8,2,2099200
like,1,s,utf8,3,2099200
max,1,s,utf8,-1,2099200
max,1,w,utf8,1,2097152
min,1,s,utf8,-1,2099200
min,1,w,utf8,1,2097152
lead,1,w,utf8,1,2097152
lead,1,w,utf8,3,2097152
lead,1,w,utf8,2,2097152
log10,1,s,utf8,1,2099200
lower,1,s,utf8,1,2099200
ltrim,1,s,utf8,1,2099200
ltrim,1,s,utf8,2,2099200
first_value,1,w,utf8,1,2097152
pi,1,s,utf8,0,2099200
length,1,s,utf8,1,2099200
likely,1,s,utf8,1,2099200
json_set,1,s,utf8,-1,2048
edit,0,s,utf8,2,0
edit,0,s,utf8,1,0
usleep,0,s,utf8,1,0
shell_idquote,0,s,utf8,1,0
shell_escape_crnl,0,s,utf8,1,0
shell_putsnl,0,s,utf8,1,0
ieee754_from_blob,0,s,utf8,1,2097152
shell_add_schema,0,s,utf8,3,0
ieee754_to_blob,0,s,utf8,1,2097152
ieee754,0,s,utf8,2,2097152
ieee754,0,s,utf8,1,2097152
shell_int32,0,s,utf8,2,0
regexp,0,s,utf8,2,2099200
ieee754_exponent,0,s,utf8,1,2097152
decimal_sub,0,s,utf8,2,2099200
decimal_cmp,0,s,utf8,2,2099200
writefile,0,s,utf8,-1,524288
lsmode,0,s,utf8,1,0
readfile,0,s,utf8,1,524288
match,0,s,utf8,2,0
fts3_tokenizer,0,s,utf8,2,524288
fts3_tokenizer,0,s,utf8,1,524288
ieee754_mantissa,0,s,utf8,1,2097152
decimal_add,0,s,utf8,2,2099200
decimal,0,s,utf8,1,2099200
snippet,0,s,utf8,-1,0
offsets,0,s,utf8,1,0
shell_module_schema,0,s,utf8,1,0
matchinfo,0,s,utf8,2,0
matchinfo,0,s,utf8,1,0
optimize,0,s,utf8,1,0
decimal_sum,0,w,utf8,1,2099200
sha3,0,s,utf8,2,2099200
sha3,0,s,utf8,1,2099200
rtreedepth,0,s,utf8,1,0
regexpi,0,s,utf8,2,2099200
decimal_mul,0,s,utf8,2,2099200
sha3_query,0,s,utf8,2,524288
sha3_query,0,s,utf8,1,524288
rtreenode,0,s,utf8,2,0
rtreecheck,0,s,utf8,-1,0
0
/* No STAT tables available */
0
2147483647
```
## Expectation
```sql
pow,1,s,utf8,2,2099200
median,1,w,utf8,1,0
group_concat,1,w,utf8,1,2097152
group_concat,1,w,utf8,2,2097152
json_type,1,s,utf8,1,2099200
json_type,1,s,utf8,2,2099200
jsonb_set,1,s,utf8,-1,3147776
julianday,1,s,utf8,-1,2099200
ntile,1,w,utf8,1,2097152
nullif,1,s,utf8,2,2099200
sqlite_compileoption_get,1,s,utf8,1,2097152
json_valid,1,s,utf8,1,2099200
json_valid,1,s,utf8,2,2099200
json_quote,1,s,utf8,1,3147776
json_patch,1,s,utf8,2,2099200
->,1,s,utf8,2,2099200
json_array,1,s,utf8,-1,3147776
current_timestamp,1,s,utf8,0,2097152
power,1,s,utf8,2,2099200
sqlite_compileoption_used,1,s,utf8,1,2097152
json_remove,1,s,utf8,-1,2099200
json_pretty,1,s,utf8,1,2099200
json_pretty,1,s,utf8,2,2099200
jsonb_patch,1,s,utf8,2,2099200
json_object,1,s,utf8,-1,3147776
json_insert,1,s,utf8,-1,3147776
->>,1,s,utf8,2,2099200
jsonb_array,1,s,utf8,-1,3147776
sin,1,s,utf8,1,2099200
sum,1,w,utf8,1,2097152
quote,1,s,utf8,1,2099200
printf,1,s,utf8,-1,2099200
likelihood,1,s,utf8,2,2099200
json_replace,1,s,utf8,-1,3147776
jsonb_remove,1,s,utf8,-1,2099200
jsonb_object,1,s,utf8,-1,3147776
jsonb_insert,1,s,utf8,-1,3147776
json_extract,1,s,utf8,-1,2099200
last_value,1,w,utf8,1,2097152
rank,1,w,utf8,0,2097152
sign,1,s,utf8,1,2099200
sqrt,1,s,utf8,1,2099200
sinh,1,s,utf8,1,2099200
tan,1,s,utf8,1,2099200
round,1,s,utf8,1,2099200
round,1,s,utf8,2,2099200
rtrim,1,s,utf8,1,2099200
rtrim,1,s,utf8,2,2099200
jsonb_replace,1,s,utf8,-1,3147776
jsonb_extract,1,s,utf8,-1,2099200
nth_value,1,w,utf8,2,2097152
tanh,1,s,utf8,1,2099200
random,1,s,utf8,0,2097152
trim,1,s,utf8,1,2099200
trim,1,s,utf8,2,2099200
time,1,s,utf8,-1,2099200
radians,1,s,utf8,1,2099200
trunc,1,s,utf8,1,2099200
total,1,w,utf8,1,2097152
substr,1,s,utf8,2,2099200
substr,1,s,utf8,3,2099200
replace,1,s,utf8,3,2099200
percentile,1,w,utf8,2,0
unhex,1,s,utf8,1,2099200
unhex,1,s,utf8,2,2099200
upper,1,s,utf8,1,2099200
subtype,1,s,utf8,1,3147776
typeof,1,s,utf8,1,2099200
load_extension,1,s,utf8,1,524288
load_extension,1,s,utf8,2,524288
json_group_array,1,w,utf8,1,3147776
avg,1,w,utf8,1,2097152
unistr,1,s,utf8,1,2099200
abs,1,s,utf8,1,2099200
octet_length,1,s,utf8,1,2099200
json_group_object,1,w,utf8,2,3147776
jsonb_group_array,1,w,utf8,1,3147776
json_array_length,1,s,utf8,1,2099200
json_array_length,1,s,utf8,2,2099200
strftime,1,s,utf8,-1,2099200
atan,1,s,utf8,1,2099200
asin,1,s,utf8,1,2099200
acos,1,s,utf8,1,2099200
unknown,1,s,utf8,-1,2099200
substring,1,s,utf8,2,2099200
substring,1,s,utf8,3,2099200
randomblob,1,s,utf8,1,2097152
unicode,1,s,utf8,1,2099200
jsonb_group_object,1,w,utf8,2,3147776
timediff,1,s,utf8,2,2099200
percent_rank,1,w,utf8,0,2097152
row_number,1,w,utf8,0,2097152
atanh,1,s,utf8,1,2099200
asinh,1,s,utf8,1,2099200
acosh,1,s,utf8,1,2099200
cos,1,s,utf8,1,2099200
atan2,1,s,utf8,2,2099200
string_agg,1,w,utf8,2,2097152
last_insert_rowid,1,s,utf8,0,2097152
sqlite_log,1,s,utf8,2,2099200
unlikely,1,s,utf8,1,2099200
json_error_position,1,s,utf8,1,2099200
cosh,1,s,utf8,1,2099200
ceil,1,s,utf8,1,2099200
char,1,s,utf8,-1,2099200
unixepoch,1,s,utf8,-1,2099200
exp,1,s,utf8,1,2099200
percentile_disc,1,w,utf8,2,0
percentile_cont,1,w,utf8,2,0
count,1,w,utf8,0,2097152
count,1,w,utf8,1,2097152
date,1,s,utf8,-1,2099200
concat,1,s,utf8,-3,2099200
sqlite_offset,1,s,utf8,1,2099200
ceiling,1,s,utf8,1,2099200
total_changes,1,s,utf8,0,2097152
changes,1,s,utf8,0,2097152
unistr_quote,1,s,utf8,1,2099200
sqlite_version,1,s,utf8,0,2097152
if,1,s,utf8,-4,2099200
coalesce,1,s,utf8,-4,2099200
degrees,1,s,utf8,1,2099200
floor,1,s,utf8,1,2099200
glob,1,s,utf8,2,2099200
zeroblob,1,s,utf8,1,2099200
hex,1,s,utf8,1,2099200
iif,1,s,utf8,-4,2099200
sqlite_source_id,1,s,utf8,0,2097152
concat_ws,1,s,utf8,-4,2099200
format,1,s,utf8,-1,2099200
datetime,1,s,utf8,-1,2099200
cume_dist,1,w,utf8,0,2097152
ln,1,s,utf8,1,2099200
instr,1,s,utf8,2,2099200
json,1,s,utf8,1,2099200
dense_rank,1,w,utf8,0,2097152
log,1,s,utf8,1,2099200
log,1,s,utf8,2,2099200
ifnull,1,s,utf8,2,2099200
jsonb,1,s,utf8,1,2099200
current_date,1,s,utf8,0,2097152
current_time,1,s,utf8,0,2097152
lag,1,w,utf8,1,2097152
lag,1,w,utf8,3,2097152
lag,1,w,utf8,2,2097152
mod,1,s,utf8,2,2099200
log2,1,s,utf8,1,2099200
like,1,s,utf8,2,2099200
like,1,s,utf8,3,2099200
max,1,s,utf8,-3,2099200
max,1,w,utf8,1,2097152
min,1,s,utf8,-3,2099200
min,1,w,utf8,1,2097152
lead,1,w,utf8,1,2097152
lead,1,w,utf8,3,2097152
lead,1,w,utf8,2,2097152
log10,1,s,utf8,1,2099200
lower,1,s,utf8,1,2099200
ltrim,1,s,utf8,1,2099200
ltrim,1,s,utf8,2,2099200
first_value,1,w,utf8,1,2097152
pi,1,s,utf8,0,2099200
length,1,s,utf8,1,2099200
likely,1,s,utf8,1,2099200
json_set,1,s,utf8,-1,3147776
usleep,0,s,utf8,1,0
shell_putsnl,0,s,utf8,1,0
dtostr,0,s,utf8,2,0
dtostr,0,s,utf8,1,0
sqlar_uncompress,0,s,utf8,2,2097152
sqlar_compress,0,s,utf8,1,2097152
zipfile,0,a,utf8,-1,0
lsmode,0,s,utf8,1,0
writefile,0,s,utf8,-1,524288
readfile,0,s,utf8,1,524288
ieee754_from_blob,0,s,utf8,1,2097152
offsets,0,s,utf8,1,0
decimal_cmp,0,s,utf8,2,2099200
fts3_tokenizer,0,s,utf8,2,524288
fts3_tokenizer,0,s,utf8,1,524288
decimal,0,s,utf8,1,2099200
sha1b,0,s,utf8,1,2099200
zipfile_cds,0,s,utf8,-1,0
decimal_mul,0,s,utf8,2,2099200
matchinfo,0,s,utf8,2,0
matchinfo,0,s,utf8,1,0
ieee754_inc,0,s,utf8,2,2097152
optimize,0,s,utf8,1,0
rtreedepth,0,s,utf8,1,0
ieee754_mantissa,0,s,utf8,1,2097152
rtreenode,0,s,utf8,2,0
shell_add_schema,0,s,utf8,3,0
strtod,0,s,utf8,1,0
rtreecheck,0,s,utf8,-1,0
shell_module_schema,0,s,utf8,1,0
match,0,s,utf8,2,0
sha1,0,s,utf8,1,2099200
sha1_query,0,s,utf8,1,524288
sha3,0,s,utf8,2,2099200
sha3,0,s,utf8,1,2099200
sha3_agg,0,a,utf8,2,2099200
sha3_agg,0,a,utf8,1,2099200
ieee754_exponent,0,s,utf8,1,2097152
ieee754,0,s,utf8,2,2097152
ieee754,0,s,utf8,1,2097152
decimal_sub,0,s,utf8,2,2099200
regexpi,0,s,utf8,2,2099200
sha3_query,0,s,utf8,2,524288
sha3_query,0,s,utf8,1,524288
stmtrand,0,s,utf8,0,0
stmtrand,0,s,utf8,1,0
decimal_exp,0,s,utf8,1,2099200
ieee754_to_blob,0,s,utf8,1,2097152
base85,0,s,utf8,1,2623488
decimal_add,0,s,utf8,2,2099200
edit,0,s,utf8,2,0
edit,0,s,utf8,1,0
decimal_pow2,0,s,utf8,1,2099200
base64,0,s,utf8,1,2623488
snippet,0,s,utf8,-1,0
decimal_sum,0,w,utf8,1,2099200
regexp,0,s,utf8,2,2099200
0
/* No STAT tables available */
0
2147483647
```
## Flag
```
-separator ","
```