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
getTypeInfo() may not return data in the order specified in Oracle documentation (https://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getTypeInfo()): #716
Comments
Ordering just by numeric type code, as in the proposed fix, is not sufficient. The spec also says
With server 10.1 and JDBC 42.1.4, the result contains
But for being able to find the best match for Types.VARCHAR (12) and Types.DOUBLE (8), they should appear in this order:
|
can you propose a fix to pr#910 |
As a quick fix if you have an app you cannot change the code for, I have forked Not a fix though, until someone can come up with how to sort |
@davecramer what about changing the sql in
No harm to have a 3rd column as it is not read. |
@yiga2 agreed, feel like providing us with a PR ? |
fixed in #1506 |
Not sure this is fixed actually. Just tried with |
As mentioned earlier, a not-so-hacky way actually to achieve this is to:
|
So, finally had a chance to look at this and
|
Retrieves a description of all the data types supported by this database. They are ordered by DATA_TYPE and then by how closely the data type maps to the corresponding JDBC SQL type.
With the following code snippet:
try (Connection connection = dataSource.getConnection(); ResultSet rs = connection.getMetaData().getTypeInfo()) {
while (rs.next()) {
System.out.println(rs.getInt("DATA_TYPE"));
}
} catch (SQLException e) {}
I am getting DATA_TYPE in a non-monotonic order:
-7
-2
1
12
-5
...
Additional metadata:
JDBC driver: PostgreSQL 9.4.1212
Server version: 9.6beta1.0 (9.6beta1.0)
The text was updated successfully, but these errors were encountered: