Bug #112876 | ICP (Index condition pushdown) causing BIGINT UNSIGNED value out of range error | ||
---|---|---|---|
Submitted: | 28 Oct 2023 16:43 | Modified: | 10 Nov 2023 11:34 |
Reporter: | senthil nathan | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.33 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | ICP, IndexConditionPushDown, Optimizer |
[28 Oct 2023 16:43]
senthil nathan
[28 Oct 2023 16:56]
senthil nathan
mysqldump of the table
Attachment: 1.sql (application/octet-stream, text), 4.94 MiB.
[30 Oct 2023 12:07]
MySQL Verification Team
Hi Mr. nathan, Thank you for your bug report. However, we fail to see why are you reporting this problem as a bug. Because, when `authservice`.`route`.`networkLen` is larger then 32, then you are out of the range for the unsigned integer. Not a bug.
[31 Oct 2023 2:52]
senthil nathan
It is a bug because there is no way to run the query. It fails even when using GREATEST function and removing all negative values. mysql> SELECT DISTINCT route.id routeId FROM routes route WHERE route.fieldId = 1 AND (-1 << GREATEST(32-networkLen, 0)) & INET_ATON('183.115.195.215') = INET_ATON(ip) ; ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '(32 - `authservice`.`route`.`networkLen`)' I am using Greatest of 32-networkLen and 0, which will cast negative values to 0. Even in this case, it fails. It only runs fine, if I remove networkLen from the fieldId index.
[31 Oct 2023 12:53]
MySQL Verification Team
HI Mr. nathan, This seems like a possible bug with Index Condition Pushdown. However, we need a table with sufficient rows, so that we can try to repeat the problem. We are waiting on your full feedback, including rows and precisely the query that is failing and the one that is succeeding. Waiting on your feedback.
[10 Nov 2023 5:00]
senthil nathan
I have already added the mysqldump for the table while creating the bug and I have provided the query that fails. Are you expecting something else? can you provide details? If you create the table using the provided dump and run the query provided, it reproduces directly.
[10 Nov 2023 11:34]
MySQL Verification Team
Hi Mr. nathan, We have reproduced your test case. However, it is not a bug. The problem is in your query, notable the expression: -1 << GREATEST(32-networkLen, 0) The rules of expression evaluation require that the type of the expression 32 - networkLen is UNSIGNED BIGINT , due to the type of the column. Hence, you can either change networkLen to SIGNED or try to use CAST() in order to have your query working. Not a bug.