Skip to content

Feature request: Add Pool.newConnection() which always creates a new connection, similar to Pool.logicalReplication() #14

@dko-slapdash

Description

@dko-slapdash

Currently, pgwire.pool() method doesn't require awaiting (i.e. it returns a non-Promise), and this is great, because I can call it in e.g. objects' constructors.

Also, there is Pool.logicalReplication() method which is also very convenient: it always creates a new connection for streaming the changes.

But Pool can't create connections for another type of usecases: when I run a huge SELECT * FROM tbl query and want to stream the rows from it for minutes (the table is big). This also requires a new connection creation, and Pool can't do this.

I propose to close the gap and add newConnection() to Pool class. Otherwise, there is no other way to create a connection without awaiting on it (pgwire.connect() returns a Promise), and non-async connecting is a good thing to have.

Below is a code example, what I have to do - use Connection class directly (although it's not default-exported by the library). I could've used pgwire.pool() for this (with poolMaxConnections=1), but it doesn't have newConnection().

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions