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

【sql mode】there is a problem in operator priority #2396

Closed
manannan2017 opened this issue Dec 6, 2019 · 2 comments
Closed

【sql mode】there is a problem in operator priority #2396

manannan2017 opened this issue Dec 6, 2019 · 2 comments

Comments

@manannan2017
Copy link
Contributor

1、set sql mode
set sql_mode=PIPES_AS_CONCAT;

2、problems
2.1
doris:
image
mysql:
image

2.2
select (1||'a'>0) || 1;
ERROR 1064 (HY000): Unexpected exception: null
excepted NULL or #below:
image

#2252

@xy720
Copy link
Member

xy720 commented Dec 6, 2019

work in progress

imay pushed a commit that referenced this issue Dec 16, 2019
This commit will promote the priority of the || operator to the front of the + - * / mod operators.
It solves the problems 2.1 that mentioned at issue #2396 .

For problem at 2.2 in issue #2396 , it is actually the same problem mentioned in issue #2142 . As it said in pr #2398 before, the influence of modifying that logic will cause semantic errors in insert and load, so this commit will left the bug unsolved temporary.

appendix:
In Mysql 5.7.27
|| and |
select 23|1||7;
23
select (23|1)||7
237
select 23|(1||7)
23
Priority : || > |

|| and &
select 10&1||7;
0
select (10&1)||7
7
select 10&(1||7)
0
Priority : || > &

|| and ^
select 10^1||7
27
select (10^1)||7
117
select 10^(1||7)
27
Priority : || > ^

|| and ~
select ~1||7
184467440737095516147
select ~(1||7)
18446744073709551598
priority : || < ~
@xy720
Copy link
Member

xy720 commented Jan 21, 2020

These two problems have been fixed.

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

No branches or pull requests

3 participants