Skip to content

Why doesn't DuckDBConnection.duplicate return a DuckDBConnection? #434

Closed

Description

@blacelle

I consider DuckDBConnection.duplicate():

    public Connection duplicate() throws SQLException {
        checkOpen();
        connRefLock.lock();
        try {
            checkOpen();
            return new DuckDBConnection(DuckDBNative.duckdb_jdbc_connect(connRef), url, readOnly, sessionInitSQL,
                                        autoCommit);
        } finally {
            connRefLock.unlock();
        }
    }

Why does it returns a Connection instead of a DuckDBConnection?

Thanks

Activity

  1. changed the title [-]Why does `DuckDBConnection.duplicate` does not returns a `DuckDBConnection`?[/-] [+]Why doesn't `DuckDBConnection.duplicate` return a `DuckDBConnection`?[/+] on Nov 3, 2025
  2. added a commit that references this issue on Nov 9, 2025
    7978298
  3. staticlibs commented on Nov 9, 2025

    @staticlibs
    Member

    @blacelle

    Thanks for the report! I think this is an oversight. In theory we may want to return some kind of a side-class there instead of the same class, but currently there are no plans to do so (and later it can just subclass the DuckDBConnection). Filed #455 to fix this.

  4. added a commit that references this issue on Nov 10, 2025
    c7cb0f2
  5. added 2 commits that reference this issue on Nov 10, 2025
    68995d2
    f1f7052
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