Skip to content

Feature request: Static array types with fetch_types false #1164

Description

@Desuuuu

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions