duckdb/pg_duckdb

Support arrays with a fixed length

Ouverte

#602 ouverte le 14 févr. 2025

 (0 commentaire) (0 réaction) (0 personne assignée)C++ (183 forks)github user discovery
good first issuetypes

Métriques du dépôt

Stars
 (3 125 étoiles)
Métriques de merge PR
 (Merge moyen 60j 10h) (7 PRs mergées en 30 j)

Description

Description

DuckDB allows arrays to have a fixed length. But returning those from a query currently throws an error that we don't support the type.

select * from duckdb.query($$ select [1, 2]::int[2] $$);
WARNING:  01000: (PGDuckDB/GetPostgresDuckDBType) Could not convert DuckDB type: INTEGER[2] to Postgres type
LOCATION:  GetPostgresDuckDBType, pgduckdb_types.cpp:1098
ERROR:  XX000: (PGDuckDB/CreatePlan) Cache lookup failed for type 0
LOCATION:  CreatePlan, pgduckdb_planner.cpp:76

It should be pretty simple to support these by simply converting them to a postgres array type (without a specified length). i.e. convert INTEGER[2] to INTEGER[] automatically.

Once we do this we should be able to un-exclude a bunch of these lines: https://github.com/duckdb/pg_duckdb/blob/02ebeaec1b42619fab806fc881e67de0821b380d/test/regression/expected/test_all_types.out#L21-L27

Guide contributeur