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
Crashing by Division Operators #7026
Comments
We appear to have a lot of issues with context-dependent decimal casting: tmp4> select 1 where ((1/-364240480)/(88044)) != 0;
Empty set (0.00 sec)
tmp4> select 1 where ((1/-364240480)/(880)) != 0;
+---+
| 1 |
+---+
| 1 |
+---+ Generally our decimal casting in SELECT statements seems fine, but are mostly incorrect when we try to cast the same values to boolean in filters. |
So fixing the panic is kind of trivial, but while trying to test I'm finding a lot of MySQL incompatibilities: @@ -551,7 +551,17 @@ func GetPrecisionAndScale(val interface{}) (uint8, uint8) {
default:
str = fmt.Sprintf("%v", v)
}
- return GetDecimalPrecisionAndScale(str)
+ p, s := GetDecimalPrecisionAndScale(str)
+ if s > types.DecimalTypeMaxScale {
+ s = types.DecimalTypeMaxScale
+ }
+ if p > types.DecimalTypeMaxPrecision {
+ p = types.DecimalTypeMaxPrecision
+ }
+ return p, s
} |
dolthub/go-mysql-server#2154 fixes the panic, it doesn't fix the decimal->bool type conversion in filters |
@max-hoffman Thanks for your hard work. Want to ask if we should report decimal-related issues before you solve it. |
I think I misspoke yesterday, it looks like we do return the correct value for this script. Anything that fails in |
The following test case crashed go-mysql-server.
Here's my error trace:
I originally find this by building dolt from source cersion 4cffade. It could also be reproduced in 1.26.1.
The text was updated successfully, but these errors were encountered: