Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-connection type parser overrides #676

Closed
whitelynx opened this issue Nov 12, 2014 · 2 comments · Fixed by #679
Closed

Per-connection type parser overrides #676

whitelynx opened this issue Nov 12, 2014 · 2 comments · Fixed by #679

Comments

@whitelynx
Copy link
Contributor

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?

@brianc
Copy link
Owner

brianc commented Nov 14, 2014

This is definitely in the works - will leave this open so I can circle back around once it's done!

@whitelynx
Copy link
Contributor Author

Aah, ok... I had actually started a branch with an implementation yesterday. I can still submit a PR if you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants