porsager / porsager/postgres

Boolean array type inference error

Open
#471 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v4
Dominant language
JavaScript
Stars
8.7k
Forks
374
Avg merge
11d 16h
Merged PRs (30d)
1

Description

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
https://github.com/porsager/postgres/pull/392

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the two JavaScript SQL examples from the issue to reproduce the incorrect boolean-array inference and cast error. Review pull request 392 for the proposed direction, then verify that interpolated boolean arrays can be explicitly cast to bool[] and return the expected array result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.