-
Notifications
You must be signed in to change notification settings - Fork 849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: core when use histogram #5489
Comments
@geezhu This was trivial to reproduce. Thanks for an excellent bug report! |
The issue is caused because there is a "bug" in mats=# select width_bucket(op, mn, mx, cnt) from foo;
width_bucket
--------------
-2147483648
(1 row) Since this is used as an index into an array here, it will cause an invalid memory access: int32 bucket = DatumGetInt32(DirectFunctionCall4(width_bucket_float8,
val_datum,
min_datum,
max_datum,
Int32GetDatum(nbuckets)));
/* Increment the proper histogram bucket */
Assert(bucket < state->nbuckets);
>>> if (DatumGetInt32(state->buckets[bucket]) >= PG_INT32_MAX - 1)
elog(ERROR, "overflow in histogram");
state->buckets[bucket] = Int32GetDatum(DatumGetInt32(state->buckets[bucket]) + 1); |
Fix for the |
What type of bug is this?
Crash
What subsystems and features are affected?
Other
What happened?
core when inputting following SQL with double precision limits
TimescaleDB version affected
2.9.2
PostgreSQL version used
14.6
What operating system did you use?
WSL with Linux Kernel 5.15.0
What installation method did you use?
Docker
What platform did you run on?
Other
Relevant log output and stack trace
No response
How can we reproduce the bug?
The text was updated successfully, but these errors were encountered: