-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
SqlServer TINYINT incorrect results #11209
Comments
Background I found this bug while fixing this issue, so I filed an issue to track the problem and I will send a PR to fix it. |
so it's effectively "unsigned tinyint" and should be mapped to
Failure. We don't need to do validation, since SQL Server will do it (right?) This is how "unsigned tinyint" is handled in MySQL connector trino/plugin/trino-mysql/src/main/java/io/trino/plugin/mysql/MySqlClient.java Lines 674 to 675 in e72a9bc
|
Got it, thank you for your guidance. |
This conclusion is wrong, SQL Server will check the range of values. |
We mapped Trino
TINYINT
to SqlServerTINYINT
, but I found that the mapping relationship is wrong, why?TINYINT
is[-128, 127]
TINYINT
is[0, 255]
So we can't read or write
TINYINT
values of[128, 255]
through Trino.Assuming I have a table
test_table (row_id integer, data tinyint)
in SqlServer, and the following data in the table:Then, if I read it through Trino, I will get the following result:
Since Trino's
TINYINT
supports negative numbers, what happens if I write a negative number to SqlServer via Trino? (We can't write negative numbers via SqlServer JDBC)Statement
query via SqlServer JDBC:
query via Trino:
The text was updated successfully, but these errors were encountered: