Skip to content

Conversation

@takeseem
Copy link
Contributor

fix #4191 Recover JSON column fail

Copy link
Contributor

@katzyn katzyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

Please, add a test case to TestRecovery.

@takeseem
Copy link
Contributor Author

@katzyn :)
Recover add else and add test case TestRecovery.testRecoverJson()

why rs.getMetaData().getColumnType(2) is 1111 , but H2Type.JSON.getVendorTypeNumber() is 38?

before fix rs.getString(2) is "{\"value\":[]}"
after fix: {"value":[]} is correct.

@katzyn
Copy link
Contributor

katzyn commented Jan 29, 2025

JDBC type codes and vendor-specific type codes may be entirely unrelated to each other.

In case of H2 you shouldn't try to use result from H2Type.getVendorTypeNumber(). H2Type can only be passed as is to PreparedStatement.setObject(column, Object, SQLType, …) or to ResultSet.updateObject(column, Object, SQLType, …). It can be useful for data types unknown by JDBC or for complex data types such as as array data types or ROW value data types.

@katzyn katzyn merged commit c307a7e into h2database:master Jan 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recover JSON column fail

2 participants