Skip to content

New Driver returns incorrect precision #807

@tangjiangling

Description

@tangjiangling
  • JDBC Standard(java.sql.DatabaseMetaData#getColumns):

The COLUMN_SIZE column specifies the column size for the given column. For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. Null is returned for data types where the column size is not applicable.

  • To be deprecated Driver(ru.yandex.clickhouse.ClickHouseDatabaseMetadata#getColumns):
// column size / precision
row.add(String.valueOf(columnInfo.getPrecision()));
  • New Driver(com.clickhouse.jdbc.ClickHouseDatabaseMetaData#getColumns):
r.getValue("COLUMN_SIZE").update(column.getDataType().getByteLength());

We can see that the new Driver goes against the JDBC standard and the Driver that was marked as deprecated is the right one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions