Skip to content
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

Operator precedence issue #6734

Closed
donataso opened this issue Sep 17, 2020 · 0 comments · Fixed by #6758
Closed

Operator precedence issue #6734

donataso opened this issue Sep 17, 2020 · 0 comments · Fixed by #6758
Assignees
Milestone

Comments

@donataso
Copy link

donataso commented Sep 17, 2020

Overview of the Issue

sqlparser seems to not respect parentheses, x * (a div b) is executed as x * a div b. It works correctly when executed directly in MySQL.

Reproduction Steps

  • Execute select hex(0x4000000000000000*(1500 div 1000));

Expected output:

+-----------------------------------------+
| hex(0x4000000000000000*(1500 div 1000)) |
+-----------------------------------------+
| 4000000000000000                        |
+-----------------------------------------+
1 row in set (0.00 sec)

Actual output:

ERROR 1690 (22003): vtgate: http://localhost:15001/: target: shard.0.master, used tablet: zone1-150 (localhost): vttablet: rpc error: code = InvalidArgument desc = BIGINT UNSIGNED value is out of range in '(0x4000000000000000 * 1500)' (errno 1690) (sqlstate 22003) (CallerID: userData1): Sql: "select hex(0x4000000000000000 * :vtg1 div :vtg2) from dual", BindVars: {#maxLimit: "type:INT64 value:\"10001\" "vtg1: "type:INT64 value:\"1500\" "vtg2: "type:INT64 value:\"1000\" "}

Operating system and Environment details

  • Operating system: Ubuntu 18.04.5 LTS
  • Kernel version: Linux 5.3.0-62-generic
  • Architecture: x86_64
@donataso donataso changed the title Operator precedence Operator precedence issue Sep 17, 2020
@askdba askdba added this to the v8.0 milestone Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants