-
Notifications
You must be signed in to change notification settings - Fork 619
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
DatabaseMetaData#getColumns() returns conflicting results for ResultSet#getInt("DATA_TYPE") and ResultSet#getString("TYPE_NAME") #935
Comments
- fixed multiline sql fragments - sqlite incorrectly returns VARCHAR for schema column (during DatabaseMetadata#getColumns()) --- handling this by coercing query result values to string in generated accessor code --- for longer term filed yet another sqlite bug: xerial/sqlite-jdbc#935 - other minor fixes
As a general rule, please provide reproduction code. |
My bad, but I don't have the time to provide an operational test for you, I had assumed there would be one already you could examine. Anyhow, here are the steps to reproduce the issue.
create table actor
(
actor_id INT not null
primary key,
first_name VARCHAR(45) not null,
last_name VARCHAR(45) not null,
last_update TIMESTAMP not null
);
I'm using h2 for unit tests, but I found this issue while ad hoc testing with sqlite. I haven't tested other column types with sqlite, but based on prior type-safety related jdbc driver issues I've run into with sqlite, I have a feeling TIMESTAMP is not an isolated case e.g., DATE etc. I thought perhaps you would like to know about this. Update: |
I think what you could do to fix this issue is implement |
Bold of you to believe maintainers have time while you don't even take time to explain the problems you think you have. |
Hey man, if you truly don’t understand the bug as I have described it, then ask a question; I’m happy to clarify. Otherwise, either state that you don’t agree with my analysis, which is fine. Or, fix the bug and write the test. If that doesn’t appeal to you, you ought not be a maintainer. |
DatabaseMetaData#getColumns()
returns conflicting results forResultSet#getInt("DATA_TYPE")
andResultSet#getString("TYPE_NAME")
For instance, a column with a TIMESTAMP type will have the following results:
ResultSet#getInt("DATA_TYPE")
:VARCHAR
ResultSet#getString("TYPE_NAME")
:TIMESTAMP
(declared SQL type)Of course, the right answer is TIMESTAMP. Also, for the same column referenced in a query the result is
Types#TIMESTAMP
as it should be.ResultSetMetaData#getColumnType(index)
:Types#TIMESTAMP
Please fix the
ResultSet#getInt("DATA_TYPE")
for use withDatabaseMetaData#getColumns()
.The text was updated successfully, but these errors were encountered: