Skip to content

PGPREPARE=false, PGFETCH_TYPES=false and PGDEBUG=false turn those options on #49

Closed

Description

@okomarov

Options fall back to PG<OPTION> environment variables (src/index.js, around line 692: env['PG' + k.toUpperCase()] || d). URL values go through a check that turns 'false' and 'disable' into false; environment values don't. So any non-empty value enables the option, including 'false':

  • PGPREPARE=false: prepared statements on (q.prepare = options.prepare && … only tests truthiness). Behind PgBouncer or Supavisor in transaction mode this produces prepared-statement errors.
  • PGFETCH_TYPES=false: type fetching on.
  • PGDEBUG=false: debug on, so query parameters are added to error objects.

Inherited from upstream. The README says only that options "fall back to the same environment variables as psql" and doesn't document these PG<OPTION> variables, so few setups rely on them.

Fix: apply the same 'false'/'disable' mapping to environment values as to URL values. This changes behaviour only for setups that set one of these to false and currently get the opposite.

Same problem for SSL: PGSSL=disable or PGSSL=false turns SSL on, because the string is truthy. PGSSLMODE is never read, only PGSSL, so the README claim that options fall back to the same environment variables as psql is not quite true. Related: an explicit password: '' falls back to PGPASSWORD.

Activity

  1. added
    bug
    on Oct 13, 2026
  2. moved this to Later in Roadmapon Oct 15, 2026
  3. added
    area: config
    on Oct 16, 2026
  4. added this to the 4.5.0 milestone on Oct 16, 2026
  5. moved this from Later to In progress in Roadmapon Oct 16, 2026
  6. okomarov commented on Oct 17, 2026

    @okomarov
    Author

    Fixed on main in 93ef818: PG environment values now map false and disable to off, like URL values. The remaining parts are tracked separately: PGSSLMODE in #125, the password '' fallback in #126.

  7. added a commit that references this issue on Oct 17, 2026
    c01e2ef
  8. okomarov commented on Oct 17, 2026

    @okomarov
    Author

    Shipped in 4.5.0.

  9. moved this from In progress to Shipped in Roadmapon Oct 17, 2026
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

    area: configbug

    Type

    No type

    Projects

    • Status
      Shipped

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions