Search Postgresql Archives

Handling of tz-aware literals in non-tz-aware fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

the issue can be show with this example:

    piro=> SET TIMEZONE = 'America/New_York';
    SET

    piro=> select '1970-01-01T00:00:00+03:00'::timestamp;
          timestamp
    ---------------------
     1970-01-01 00:00:00
    (1 row)

    piro=> select '1970-01-01T00:00:00+03:00'::timestamptz::timestamp;
          timestamp
    ---------------------
     1969-12-31 16:00:00
    (1 row)

I find surprising that an unknown literal containing a TZ-aware
timestamp has the tz info discarded (e.g. upon insertion in a
timestamp without time zone field), whereas the cast from tz-aware to
non-tz-aware performs a conversion. I find the second behaviour much
more reasonable.

Is there an explanation for the first behaviour?

Is the first behaviour documented?

Thank you very much,


-- Daniele


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux