Skip to content

JDBC: ResultSet.getObject(int, java.sql.Struct.class) fails for STRUCT column #900

Closed

Description

@ventod

Bug description

For a STRUCT column, DuckDB JDBC reports org.duckdb.DuckDBStruct as the column class through ResultSetMetaData, which extends java.sql.Struct, but ResultSet.getObject(..., Struct.class) fails with a conversion error.

Reproduction

Create a table containing a STRUCT column:

CREATE TABLE test_table (
    struct_col STRUCT(name VARCHAR, age INTEGER) NOT NULL
);

Execute a simple query:

SELECT struct_col FROM test_table;

The ResultSetMetaData reports:

Metadata Value
getColumnName() struct_col
getColumnTypeName() STRUCT("name" VARCHAR, age INTEGER)
getColumnType() 2002 (java.sql.Types.STRUCT)
getColumnClassName() org.duckdb.DuckDBStruct

DuckDBStruct implements java.sql.Struct.

However, attempting to retrieve the value using the standard JDBC typed getter:

Struct value = resultSet.getObject(1, Struct.class);

fails with:

java.sql.SQLException: Can't convert value to interface java.sql.Struct, SQL type: STRUCT

I am using ResultSet.getObject(index, Struct.class) because getStruct() is only exposed through the DuckDB-specific org.duckdb.DuckDBResultSet, rather than the standard java.sql.ResultSet interface.

Environment

  • DuckDB JDBC: 1.5.6.0
  • SQL type: STRUCT
  • Java type reported by metadata: org.duckdb.DuckDBStruct
  • JDBC type: java.sql.Types.STRUCT (2002)

Activity

  1. changed the title [-]JDBC: ResultSet.getObject(int, Class) fails for STRUCT as java.sql.Struct[/-] [+]JDBC: ResultSet.getObject(int, java.sql.Struct.class) fails for STRUCT column[/+] on Oct 8, 2026
  2. added a commit that references this issue on Oct 20, 2026
  3. staticlibs commented on Oct 20, 2026

    @staticlibs
    Member

    Closing as fixed in #942

  4. added a commit that references this issue on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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