Skip to content

native driver ignores statement_timeout #2103

Open

Description

@gajus
const pool = new pg.Pool({
  statement_timeout: 1000,
});

Passing statement_timeout to node-postgres when using pg-native has no effect on the statement_timeout configuration.

Activity

  1. brianc commented on Feb 12, 2020

    @brianc
    Owner

    This might be a pretty easy fix if you're interested in doing a PR. Otherwise I'll get to it soon-ish but I've got a bunch of other stuff in the pipeline too. 🙏

  2. gajus commented on Feb 13, 2020

    @gajus
    ContributorAuthor

    Switching to the JavaScript driver now throws:

          error: unsupported startup parameter: statement_timeout
              at Connection.parseE (/Users/gajus/Documents/dev/rayroute/rayman/node_modules/pg/lib/connection.js:614:13)
              at Connection.parseMessage (/Users/gajus/Documents/dev/rayroute/rayman/node_modules/pg/lib/connection.js:413:19)
              at TLSSocket.<anonymous> (/Users/gajus/Documents/dev/rayroute/rayman/node_modules/pg/lib/connection.js:129:22)
              at TLSSocket.emit (events.js:321:20)
              at TLSSocket.EventEmitter.emit (domain.js:485:12)
              at addChunk (_stream_readable.js:297:12)
              at readableAddChunk (_stream_readable.js:273:9)
              at TLSSocket.Readable.push (_stream_readable.js:214:10)
              at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)
    
    
  3. boromisp commented on May 21, 2020

    @boromisp
    Contributor

    @gajus Could the unsupported startup parameter error be related to this: https://www.pgbouncer.org/config.html#ignore_startup_parameters?

  4. shayonj commented on Aug 30, 2020

    @shayonj

    At @loomhq we are looking to see if we can using this with our sequelize setup. I noticed statement_timeout doesn't get applied when using the native driver as well. Proposed a PR to fix in #2323. Also, added support for idle_in_transaction_session_timeout.

  5. shayonj commented on Sep 3, 2020

    @shayonj

    Re:

      error: unsupported startup parameter: statement_timeout
    

    This is expected from pgbouncer, because statement_timeout is not part of ignore_startup_parameters (pgbouncer's config). However, when the fix ships it will complain on options (since we do options=-c statement_timeout=...).

    The issue here is pgbouncer ignores startup parameter once added to ignore_startup_parameters (it only does so that pgbouncer doesn't hard fail), so passing statement_timeout via options to pgbouncer won't work I believe.

    The fix should still work when working against DB server.

  6. lemuelflores commented on Jul 11, 2023

    @lemuelflores

    @shayonj Thanks. I appreciate the explanation.

    I use slonik which uses node-postgres under the hood and have to connect to PgBouncer. I keep getting "unsupported startup parameter" error and I have no clue PgBouncer is incompatible with these timeout options. Disabling them fixed it.

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

      Development

      No branches or pull requests

      Issue actions