Skip to content

Potential Issue Using ROUND #7073

Closed
dolthub/go-mysql-server
#2187

Description

@suyZhong

Consider the following test cases, the second query executes slowly. (I'm using MySQL client)

mysql> SELECT ROUND(3, -9999999);
+--------------------+
| ROUND(3, -9999999) |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

mysql> SELECT ROUND(3%5, -9999999); -- increasing the second argument would lead to server hang
+----------------------+
| ROUND(3%5, -9999999) |
+----------------------+
|                    0 |
+----------------------+
1 row in set (3.19 sec)

I understand that the negative value for the second argument of ROUND is somewhat illegal. However, when it goes to -1e8, the query needs more than 1 minute to execute. MySQL takes less than 0.01 second.

I originally find this in the source code version 804f1c1. It could also be reproduced in 1.26.1.

Activity

  1. timsehn commented on Nov 30, 2023

    @timsehn
    SponsorContributor

    This is very interesting. Keep the bugs coming. They are awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions