-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
How to configure types only for a particular instance of node-postgres? #1838
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
Comments
This could be as simple as allowing to override Line 34 in fcd0f02
|
const TypeOverrides = require('pg/lib/type-overrides');
const OID_INT8 = 20;
const types = new TypeOverrides();
types.setTypeParser(OID_INT8, BigInt);
const pool = new pg.Pool({
⋮
types,
});
const client = new pg.Client({
⋮
types,
}); |
Is there a way to override const client = new pg.Client({});
client._types = types; The latter does not seem to do the trick. Will debug this further on my own (seems like I could definitely override the query getTypeParser, Line 459 in fcd0f02
|
On a pool or a client? What you wrote should work fine for a client for queries after the assignment. |
Thank you |
Just in case anyone comes across this, if you are using |
`TypeOverrides` is too important not to expose it. It should be available from the root. Related: brianc#1838, brianc#2363
It appears that the only way to configure type parser is by doing so globally, i.e.
– https://github.com/brianc/node-pg-types
I would like to restrict type parsing to a particular connection.
Is there an API at the moment to do so?
The text was updated successfully, but these errors were encountered: