Skip to content

Per-connection type parser overrides #676

Closed
@whitelynx

Description

@whitelynx

I've been looking at the possibility of implementing a custom type parser for PostGIS's geometry type, using the wkx package to parse the (E)WKB it serializes as. Currently, I have a query working that gets the type OID from the database, and I have the type parser working correctly using require('pg').types.setTypeParser(); it's returning a Buffer. However, there's a big hurdle to using this in my project (a web frontend for postgres, web-pgq) - since the OIDs for types introduced by extensions may change between databases (or even on the same database over time), I can't connect to 2 databases and have the type parser work as expected on both.

I can partially work around this by registering and unregistering the type parser before and after each query, but then we get into race conditions if 2 connections are being queried simultaneously... so that's not really a tenable solution.

Could support be added for setting custom type parsers on a per-connection basis?

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