Skip to content

Boolean array type inference error #471

Open
@uasan

Description

@uasan

Boolean array, always passed as a boolean value, here is an example:

await sql`SELECT ${[false, true]} AS bool_array`
// Result(1) [ { bool_array: false } ]

this query is throwing an error

await sql`SELECT ${[true, false]}::bool[]`;
// Error cannot cast type boolean to boolean[]

I think this PR solves this problem
#392

Activity

binikingi

binikingi commented on Dec 12, 2022

@binikingi

For now what im doing is this:

await sql`SELECT ${[false, false].map(x => x ? 1 : 0)}::INT[]::BOOLEAN[]`
added a commit that references this issue on Mar 23, 2025
cf7e29f
linked a pull request that will close this issue on Mar 23, 2025
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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @porsager@binikingi@uasan

      Issue actions

        Boolean array type inference error · Issue #471 · porsager/postgres