Skip to content

Regression: DatabaseMetaData.getColumns returns IS_NULLABLE="true"/"false" instead of JDBC spec "YES"/"NO" #664

@wdroste

Description

@wdroste

Summary

In duckdb_jdbc 1.5.2.0, DatabaseMetaData.getColumns(...) returns values of "true" / "false" for the IS_NULLABLE column. The JDBC specification mandates "YES" / "NO" / "" (empty). 1.5.1.0 returned "YES" as expected; this is a regression.

This breaks consumers that parse IS_NULLABLE per spec — notably jOOQ's generic MetaImpl under SQLDialect.DEFAULT, whose getTables(...) then returns tables with an empty field list.

Reproduction

import java.sql.*;
import java.util.Properties;

public class Repro {
  public static void main(String[] a) throws Exception {
    var c = new org.duckdb.DuckDBDriver().connect("jdbc:duckdb:", new Properties());
    try (var s = c.createStatement()) {
      s.execute("CREATE TABLE \"t\" (\"id\" BIGINT, \"v\" VARCHAR)");
    }
    try (var rs = c.getMetaData().getColumns(null, null, "t", null)) {
      while (rs.next()) {
        System.out.println(rs.getString("COLUMN_NAME") + " -> IS_NULLABLE=" + rs.getString("IS_NULLABLE"));
      }
    }
  }
}

Observed

1.5.2.0

id -> IS_NULLABLE=true
v  -> IS_NULLABLE=true

1.5.1.0 (expected / spec-compliant)

id -> IS_NULLABLE=YES
v  -> IS_NULLABLE=YES

Spec reference

java.sql.DatabaseMetaData#getColumns, column 18 IS_NULLABLE:

String => ISO rules are used to determine the nullability for a column.

  • YES --- if the column can include NULLs
  • NO --- if the column cannot include NULLs
  • empty string --- if the nullability for the column is unknown

Boolean literals "true" / "false" are not valid per the spec.

Impact

  • Any JDBC consumer that does "YES".equals(isNullable) / "NO".equals(isNullable) will misinterpret column nullability.
  • jOOQ 3.21.x generic Meta with SQLDialect.DEFAULT returns tables with zero fields against DuckDB 1.5.2.0, whereas SQLDialect.DUCKDB (dialect-specific path) still works. This surfaces in downstream test suites that use DSL.using(conn, SQLDialect.DEFAULT).meta() for inspection.

Environment

  • duckdb_jdbc: 1.5.2.0 (regression) vs 1.5.1.0 (OK)
  • JDK: Zulu 11.0.29
  • OS: Linux x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions