-
Notifications
You must be signed in to change notification settings - Fork 36
Column metadata type changed when upgrading driver version for SUPER type #143
Copy link
Copy link
Open
Description
Hello
I have the following table in Redshift:
CREATE TABLE
test_resources_v1.types
(
id BIGINT NOT NULL,
null_double_array SUPER,
long_array SUPER,
string_array SUPER,
PRIMARY KEY (id)
);
INSERT INTO
test_resources_v1.types
(
id,
null_double_array,
long_array,
string_array)
VALUES
(1,
ARRAY(1.1, 10.01, 100.001), ARRAY(10, 15, 30), ARRAY('value', 'other-value')),
(2,
ARRAY(200.002, 20, 2.2), ARRAY(56, 202, 304), ARRAY('value 1', 'other value 3')),
(4,
null, null, null);
I use the following code to query this table:
@Test
void testArrayTypes() throws SQLException {
final Connection connection = DriverManager.getConnection(RedshiftTestConstants.REDSHIFT_JDBC_URL + RedshiftTestConstants.TEST_DATABASE_NAME,
RedshiftTestConstants.getUsername(),
RedshiftTestConstants.getRedshiftPassword());
ResultSet columns = connection.getMetaData()
.getColumns(
RedshiftTestConstants.TEST_DATABASE_NAME,
RedshiftTestConstants.TEST_SCHEMA_NAME,
"types",
"null_double_array");
columns.next();
int typeInt = columns.getInt("DATA_TYPE");
System.out.println("null_double_array typeInt = " + typeInt);
columns = connection.getMetaData()
.getColumns(
RedshiftTestConstants.TEST_DATABASE_NAME,
RedshiftTestConstants.TEST_SCHEMA_NAME,
"types",
"long_array");
columns.next();
typeInt = columns.getInt("DATA_TYPE");
System.out.println("long_array typeInt = " + typeInt);
columns = connection.getMetaData()
.getColumns(
RedshiftTestConstants.TEST_DATABASE_NAME,
RedshiftTestConstants.TEST_SCHEMA_NAME,
"types",
"string_array");
columns.next();
typeInt = columns.getInt("DATA_TYPE");
System.out.println("string_array typeInt = " + typeInt);
}When running the previous code with the JDBC driver 2.1.0.30, it returns:
null_double_array typeInt = -16
long_array typeInt = -16
string_array typeInt = -16
With the JDBC driver version 2.1.0.32 (I skipped 2.1.0.31, as your CHANGELOG mentioned it was yanked)
null_double_array typeInt = -1
long_array typeInt = -1
string_array typeInt = -1
I assume it is a regression, otherwise I would have expected a changelog entry.
It does break the following code, as we do not get the same JDBC type:
final int typeInt = resultSet.getInt("DATA_TYPE");
final JDBCType jdbcType = JDBCType.valueOf(typeInt);This provokes a breakage downstream, as we were relying on this type to convert it to array
If it is on purpose, could you document the change and explain how to migrate ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels