-
Notifications
You must be signed in to change notification settings - Fork 112
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
Not supported ISO formats of timezones #14
Comments
I think there might be a bit of a misunderstanding of how In addition, pgx uses the binary format when possible. The PostgreSQL binary format for a |
Dear Jacks, when you are saying "session time zone" are you mentioning the PG connection? Prior the execution of a stored procedure we issue the "SET TIMEZONE TO ... ". See:
result: "2019-11-25 11:23:40.999+01" |
Yes. That is changing the PG session time zone.
Well, it's not so much it converts the time zone as the time zone really doesn't exist in the binary format -- it only is a number of microseconds from 2000-01-01 00:00:00 UTC. If this is a critical requirement then the best option I can see is for you to use a custom Go type to handle You could use this custom type handler explicitly where needed or you could use ConnInfo.RegisterDataType to make it the default. |
I'm not sure my understanding is correct... but are you recommending to overwrite the default call ConnInfo.RegisterDataType with the custom self developed type?
|
Yes. Though by override I don't mean you would change it in pgtype itself. You would call RegisterDataType in an AfterConnect hook. |
Hi,
within our company we have many SPs that return time with timezones. This is because users located in different time zones and require to see date/time in their local time zone.
We faced issue that pgx ignores timezones returned by the Postgres in format "2006-01-02 15:04:05+02". As the result we see that timezones are defaulted to the server's timezone.
Currently PGX supports the following formats (taken from sources):
const pgTimestamptzHourFormat = "2006-01-02 15:04:05.999999999Z07"
const pgTimestamptzMinuteFormat = "2006-01-02 15:04:05.999999999Z07:00"
const pgTimestamptzSecondFormat = "2006-01-02 15:04:05.999999999Z07:00:00"
Is it possible to customize the default format?
The text was updated successfully, but these errors were encountered: