You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should consider sending a TIME ZONE startup parameter when connecting to PostgreSQL. This parameter affects how timestamp with time zone is rendered in text encoding (but not binary), as well as some other time-related functions etc.
If this parameter isn't set, the server's timezone is used, whatever that is. As long as the client and server happen to be in the same time zone that may be OK, but if not it seems extremely undesirable.
The PGTZ environment variable is used by libpq clients to send a SET TIME ZONE command to the server upon connection.
We should probably respect this environment variable as well (but should we also send the system timezone if this variable isn't set?)
Any comments?
EDIT: to handle cases where the user modifies the TIME ZONE manually (example), we should also intercept changes to TimeZone, and impact timestamptz conversions...
As this would help users get a better experience when using Npgsql.
+1
On Wed, Jun 17, 2015 at 10:38 AM, Shay Rojansky [email protected]
wrote:
We should consider sending a TIME ZONE startup parameter when connecting
to PostgreSQL. This parameter affects how timestamp with time zone is
rendered in text encoding (but not binary), as well as some other
time-related functions etc.
If this parameter isn't set, the server's timezone is used, whatever that
is. As long as the client and server happen to be in the same time zone
that may be OK, but if not it seems extremely undesirable.
Any comments?
—
Reply to this email directly or view it on GitHub #646.
Note that thanks to #1475 (in progress), we'll be able to add a Nodatime type mapping plugin #546. Since Nodatime has support for the different timezones and can apparently convert between them, it may be possible to implement this.
Just to prevent my own confusion, this issue isn't about converting timestamptz values according to the PostgreSQL session timezone, it's about setting the PostgreSQL session timezone based on the local machine timezone.
Am closing this in favor of #1634, which is about simply passing along what's in the PGTZ environment variable to PostgreSQL.
Translating the Windows/.NET local system timezone to PostgreSQL is difficult for the reason mentioned above - translation of Windows timezones to Olson/IANA, which we can't really do reliably without adding a dependency on something like Nodatime.
It's still possible for users to do this themselves - convert the local system timezone to Olson/IANA and have Npgsql send it etc.
Activity
franciscojunior commentedon Jun 17, 2015
I think we could add this option.
As this would help users get a better experience when using Npgsql.
+1
On Wed, Jun 17, 2015 at 10:38 AM, Shay Rojansky [email protected]
wrote:
Regards,
Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior
[-]Set timezone when opening connections?[/-][+]Synchronize timezone with PostgreSQL[/+]roji commentedon May 9, 2016
The tricky problem here is to convert system time zone names (from Windows, Linux) to PostgreSQL, not sure how standard these are.
roji commentedon May 9, 2016
This is going to be messy: PostgreSQL uses IANA/Olson, Windows uses... Windows (see http://stackoverflow.com/questions/5996320/net-timezoneinfo-from-olson-time-zone). We can include a translation table in PostgreSQL but it would become out of date... And then there's Linux/MacOS...
roji commentedon Jun 28, 2017
Note that thanks to #1475 (in progress), we'll be able to add a Nodatime type mapping plugin #546. Since Nodatime has support for the different timezones and can apparently convert between them, it may be possible to implement this.
roji commentedon Jul 2, 2017
Just to prevent my own confusion, this issue isn't about converting timestamptz values according to the PostgreSQL session timezone, it's about setting the PostgreSQL session timezone based on the local machine timezone.
roji commentedon Jul 7, 2017
Am closing this in favor of #1634, which is about simply passing along what's in the PGTZ environment variable to PostgreSQL.
Translating the Windows/.NET local system timezone to PostgreSQL is difficult for the reason mentioned above - translation of Windows timezones to Olson/IANA, which we can't really do reliably without adding a dependency on something like Nodatime.
It's still possible for users to do this themselves - convert the local system timezone to Olson/IANA and have Npgsql send it etc.