-
Notifications
You must be signed in to change notification settings - Fork 275
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
How to set DATESTYLE on new connections #645
Comments
const sql = postgres({
connection: {
DateStyle: 'your thing here'
}
}) |
Oh that was simpler than expected, thanks! I had a hunch that the connection prop could be related, it's just that only the application_name is documented anywhere. Is there some list of what connection parameters can be set via this object? |
Hehe, yeah 😊 There's quite a good list here : https://www.postgresql.org/docs/current/runtime-config-client.html Would be good to have a section in the docs for this, you're mouthe first to ask. What did you search for in the readme before posting here? |
I looked for the specific thing, datestyle, then Adding a link to that documentation page in the documentation about the In the end my issue wasn't about the datestyle after all, it was just that I had to override the default type parser for timestamps in postgresjs. The project I'm working on uses Drizzle with postgresjs, and it has it's own layer of type conversions on top. I was using that to convert my timestamps to Temporal.Instants. The documentation and source indicated that the builtin timestamp parser converts from string to Date, but the incoming value had actually been converted to a Date already by postgresjs. Maybe this helps someone with similar issues :D |
Very nice @googol !! thanks for the explanation. I'll just reopen the issue to track adding this to the docs. |
Hi,
I'm looking for a way to automatically set DATESTYLE on all new connections opened by the node pool, to facilitate parsing timestamp values into temporal instants, but I'm not finding anything that could do that.
node-postgres has the
connect
event on it's node pool that allows executing sql on all new connections before they are used, is there anything similar, or would you be open to adding that sort of functionality?The text was updated successfully, but these errors were encountered: