-
Notifications
You must be signed in to change notification settings - Fork 435
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
IS_AUTOINCREMENT & IS_GENERATEDCOLUMN returning the incorrect type (Azure DW) #1352
Comments
Hi @tsegall ,
I am confused a bit, are you trying to retrieve
I can't reproduce this behavior, the driver returns |
The issue is that the result of calling rsmd.getColumnType(i) on these two columns returns 4 and hence according to the JDBC specification you should use getInt() to retrieve their values. I have attached sample code which illustrates this problem - if you run this sample code an another database (e.g. Oracle, Postgres, etc) it will work in addition the code will work on SQL Server (both hosted and on-premise. It does not work on Azure DW. tiny.txt](https://github.com/microsoft/mssql-jdbc/files/4733613/tiny.txt) |
I can confirm the jar you supplied does in fact address the defect raised. Many thanks for the speedy resolution - it appears that this fix will make it into 8.4.0, is this correct. If so I can relay this to our customer who is looking for a fix. |
Yes, we will try to have the fix in 8.4.0 release. |
#1356 merged. |
Driver version
8.2.0
SQL Server version
Microsoft Azure SQL Data Warehouse - 10.0.11115.0 May 16 2020 02:43:26 Copyright (c) Microsoft Corporation
Client Operating System
MacOS X 10.15.4 (although the problem is present on both Windows & Linux)
JAVA/JVM version
OpenJDK Runtime Environment Corretto-8.202.08.2 (build 1.8.0_202-b08)
Table schema
Problem description
Expected Behavior
databaseMetaData.getColumns(catalog, schema, tableName, null))
should return the correct type for all columns
Actual behaviour:
The correct type is not returned for the columns IS_AUTOINCREMENT and IS_GENERATEDCOLUMN. These are returned as type 4 (Int) when they should actually be a string. This means that when you attempt to do a resultSet.getInt() you receive a ClassCastException. The actual value should be YES or NO - so the issue is that the type being returned is Int. Note: this is an Azure DW problem only and does not impact the other MS databases.
Reproduction code
Have a code example that illustrates the issue - if that would help, but the bug is relatively easy to reproduce.
The text was updated successfully, but these errors were encountered: