Feature request: Static array types with fetch_types false
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
The fetch_types: false option breaks the serializing/parsing of array types. As an example, the following fails:
import postgres from 'postgres'
const sql = postgres({
fetch_types: false
})
const result = await sql`SELECT * FROM unnest(${['foo', 'bar']}::TEXT[])`
// Throws: `PostgresError: malformed array literal: "foo,bar"`
It would be nice to have the option to pass static typeOID -> arrayTypeOID mappings in the options to have that work without incurring the cost of fetching the OIDs from the database.
An automatic fallback with standard type OIDs could also be an option with fetch_types: false considering these appear to be stable?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied fetch_types: false example and tracing the array serialization/parsing path. Investigate how typeOID and arrayTypeOID information is obtained, then define coverage for the requested static mapping or standard-OID fallback. Done means the example works without fetching types and the behavior is tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100