Skip to content

Can't cast '{1,2,3}' to integer[] in subselect #1040

@emarsden

Description

@emarsden

What happens?

Though a cast like SELECT '{1,2}'::integer[] works as expected, a cast in a subselect statement like SELECT * FROM (SELECT '{1,2,3}'::integer[]) triggers an error.

To Reproduce

pgeltestdb=# SELECT * FROM (SELECT '{1,2,3}'::integer[]);
  int4
---------
 {1,2,3}
(1 ligne)
pgeltestdb=# SET duckdb.force_execution = true;
SET
pgeltestdb=# SELECT * FROM (SELECT '{1,2,3}'::integer[]);
ERROR:  (PGDuckDB/Duckdb_ExecCustomScan_Cpp) Conversion Error: Type VARCHAR with value '{1,2,3}' can't be cast to the destination type INTEGER[]

LINE 1:  SELECT int4 FROM (SELECT '{1,2,3}'::integer[] AS int4) unnamed_subquery

OS:

Linux

pg_duckdb Version (if built from source use commit hash):

Current Dockerhub image docker.io/pgduckdb/pgduckdb:18-main

Postgres Version (if built from source use commit hash):

ostgreSQL 18.3 (Debian 18.3-1.pgdg12+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14+deb12u1) 12.2.0, 64-bit

Hardware:

No response

Full Name:

Eric Marsden

Affiliation:

None

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?

  • Yes, I have

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