-
Notifications
You must be signed in to change notification settings - Fork 427
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
Driver (?mssql server) returns wrong column nullability in ResultSet #2536
Comments
This can be reproduced on server side with below repro steps: (not an issue in the driver)
The field idi2 in being flagged as NULLABLE. |
Ok, how we can escalate this to SQLServer? |
And, I found yet one example: |
Just an update about an observation on the NULL behavior of idi2 column in the above select query (of reporting it as NULLABLE) is same in other databases such as Oracle, PostgreSQL, MySQL. (Note: PostgreSQL seem to report all three idi1, idi2 and idi3 as NULLABLE unlike the others which report only idi2 as NULLABLE) |
It’s info are from drivers or from dbs? |
It is from the dbs, using the same repro steps as used above create view testnullable as |
I’ve tested the same. Mariadb, Mysql returns not null, nullable, not null. Oracle returns not null, not null, not null. |
It could be the case that the behavior varied across different versions of Oracle. |
Driver version
12.8.1
SQL Server version
mcr.microsoft.com/mssql/server:2022-latest
Client Operating System
any
JAVA/JVM version
any
Table schema
create table table1(idi1 int not null, idf1 int not null);
create table table2(idi2 int not null, idf2 int not null);
create table table3(idi3 int not null, idf3 int not null);
insert into table1 values(1,2);
insert into table1 values(2,3);
insert into table1 values(3,4);
Problem description
Knowledge of ResultSet column nullability is crucial for convenient developer experience (application stability too).
I looked at the driver code associated with nullability, and it seems like driver reach nullability throw network protocol in "flag" field in TypeInfo.
I found simple case, where driver fails with nullability:
So, Oracle give correct answer.
Expected behavior
driver should return 0 (NotNull) for column 2
Actual behavior
driver return 1 (Nullable) for column 2, which is untruth
Error message/stack trace
Any other details that can be helpful
JDBC trace logs
The text was updated successfully, but these errors were encountered: