Skip to content

Error: unsupported C API type: 27 (UUID) #313

Description

@arouel

When working with the DuckLake extension, and appending data to a table with a UUID column I get the error: unsupported C API type: 27.

Ideally, the error message would tell a user the type name. Besides that, it would be great to support appending to UUID columns as well.

package test;

import static org.assertj.core.api.BDDAssertions.*;

import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.UUID;

import org.duckdb.DuckDBConnection;
import org.junit.jupiter.api.Test;

class DuckLakeAppenderTest {

    @Test
    void uuid_fails_with_new_appender_ducklake() throws SQLException {
        try (
            var connection = (DuckDBConnection) DriverManager.getConnection("jdbc:duckdb:");
            var statement = connection.createStatement()
        ) {
            statement.execute("""
                ATTACH 'ducklake:/tmp/test_uuid.ducklake' AS my_ducklake;
                USE my_ducklake;
                CREATE TABLE IF NOT EXISTS test (id UUID);
                """);

            var uuid = UUID.randomUUID().toString();
            try (var appender = connection.createAppender("main", "test")) {
                appender.beginRow();
                appender.append(uuid);
                appender.endRow();
                // java.sql.SQLException: Appender error, catalog: 'null', schema: 'main', table: 'test', message: unsupported C API type: 27
            }

            try (var rs = statement.executeQuery("select * from test")) {
                rs.next();
                then(rs.getString(1)).isEqualTo(uuid);
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions