IndexOutOfBoundsException in InformationExtractorJdbcDatabaseMetaDataImpl when retrieving primary key columns when ResultSet is not sorted on "KEY_SEQ"

Description

I'm trying to write a custom schema validator but I ran into an issue when trying to retrieve the primary keys from a TableInformation object.
Apparently the default extractor InformationExtractorJdbcDatabaseMetaDataImpl assumes that java.sql.DatabaseMetaData.getPrimaryKeys() returns the columns in order of "KEY_SEQ" but that is not always the case (in fact the interface makes no such guarantees). The extractor then tries to insert the ColumnInformation out of bounds of the array list.

Environment

None

Status

Assignee

Unassigned

Reporter

Miguel Diogo

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure