Skip to content

clickhouse-jdbc 0.8.x incompatible with liquibase-core #2240

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

Open
zeroEntropyy opened this issue Mar 24, 2025 · 4 comments
Open

clickhouse-jdbc 0.8.x incompatible with liquibase-core #2240

zeroEntropyy opened this issue Mar 24, 2025 · 4 comments
Assignees
Milestone

Comments

@zeroEntropyy
Copy link

It seems that clickhouse-jdbc after the 0.8.1 version is no longer compatible with liquibase.
We were successfully using 0.6.0-patch5 version successfully with liquibase. We tried to upgrade to 0.8.1 and facing certain issues with liquibase-core library. We are using liquibase-core 4.29.2 version

In the DatabaseMetaData.java class while fetching the columns metadata, the query to get columns takes system.columns.type as the DATA_TYPE, which returns a String, but liquibase-core accepts DATA_TYPE only as an Integer. This is throwing a NumberFormatException, and it seems there is no workaround for this issue.

DatabaseMetaData ->
String sql = "SELECT " + this.catalogPlaceholder + " AS TABLE_CAT, database AS TABLE_SCHEM, table AS TABLE_NAME, name AS COLUMN_NAME, system.columns.type AS DATA_TYPE, type AS TYPE_NAME, " + JdbcUtils.generateSqlTypeSizes("system.columns.type") + " AS COLUMN_SIZE, toInt32(0) AS BUFFER_LENGTH, IF (numeric_scale == 0, NULL, numeric_scale) as DECIMAL_DIGITS, toInt32(numeric_precision_radix) AS NUM_PREC_RADIX, toInt32(position(type, 'Nullable(') >= 1 ?" + 1 + " : " + 0 + ") as NULLABLE, system.columns.comment AS REMARKS, system.columns.default_expression AS COLUMN_DEF, toInt32(0) AS SQL_DATA_TYPE, toInt32(0) AS SQL_DATETIME_SUB, character_octet_length AS CHAR_OCTET_LENGTH, toInt32(system.columns.position) AS ORDINAL_POSITION, position(upper(type), 'NULLABLE') >= 1 ? 'YES' : 'NO' AS IS_NULLABLE,NULL AS SCOPE_CATALOG, NULL AS SCOPE_SCHEMA, NULL AS SCOPE_TABLE, NULL AS SOURCE_DATA_TYPE, 'NO' as IS_AUTOINCREMENT, 'NO' as IS_GENERATEDCOLUMN FROM system.columns WHERE database LIKE '" + (schemaPattern == null ? "%" : schemaPattern) + "' AND table LIKE '" + (tableNamePattern == null ? "%" : tableNamePattern) + "' AND name LIKE '" + (columnNamePattern == null ? "%" : columnNamePattern) + "' ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION";

liquibase-core ->

int dataType = columnMetadataResultSet.getInt("DATA_TYPE");

Is there a way, we may be able to override the getColumns method and change the query? Or some workaround for the issue?

@peter-yf
Copy link

peter-yf commented Mar 31, 2025

This is really bad, and will break any application/process that uses the JDBC meta-data to drive data access. DatabaseMetaData.getColumns() should return this, as defined by Java Spec:

Image

This should be fixed in the driver to adhere to the JDBC specification. It needs to return the JDBC type as defined in java.sql.Types. The driver is now just returning the name of the data type, like: "UInt32"

@YellowStallion
Copy link

Looks like there's a fix for this, developed for #2281

@Paultagoras Paultagoras added this to the 0.8.4 milestone Apr 8, 2025
@Paultagoras Paultagoras self-assigned this Apr 8, 2025
@chernser chernser assigned chernser and Paultagoras and unassigned Paultagoras and chernser Apr 15, 2025
@chernser
Copy link
Contributor

@YellowStallion thank you very much for pointing it!
@zeroEntropyy would you please confirm that the problem is solved? Thanks!

@zeroEntropyy
Copy link
Author

I need to find some time to work on this issue again, will keep the thread updated

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

No branches or pull requests

5 participants