pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedISO8601 vs POSIX offset clarification
6+ messages / 3 participants
[nested] [flat]
* ISO8601 vs POSIX offset clarification
@ 2017-12-04 02:39 Bharanee Rathna <deepfryed@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Bharanee Rathna @ 2017-12-04 02:39 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi,
the documentation around how numeric offsets are parsed from strings is a
bit confusing, are they supposed to be treated as ISO8601 or POSIX ?
e.g.
select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at time zone
'+11:00';
timezone
---------------------
2017-11-30 13:00:00
select '2017-12-01 11:00:00 -11:00'::timestamp with time zone at time zone
'+11:00';
timezone
---------------------
2017-12-01 11:00:00
The Table 8-12. Time Zone Input section at
https://www.postgresql.org/docs/9.3/static/datatype-datetime.html seems to
imply that numeric offsets would be treated as ISO8601. It's all a big
confusing and would appreciate some clarification or pointer to
documentation.
Thanks
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ISO8601 vs POSIX offset clarification
@ 2017-12-04 02:55 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bharanee Rathna <deepfryed@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2017-12-04 02:55 UTC (permalink / raw)
To: Bharanee Rathna <deepfryed@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Bharanee Rathna <deepfryed@gmail.com> writes:
> the documentation around how numeric offsets are parsed from strings is a
> bit confusing, are they supposed to be treated as ISO8601 or POSIX ?
Our documentation about this says clearly that Postgres considers offsets
to be ISO (positive-east-of-Greenwich) everywhere except in POSIX-style
time zone names.
> The Table 8-12. Time Zone Input section at
> https://www.postgresql.org/docs/9.3/static/datatype-datetime.html seems to
> imply that numeric offsets would be treated as ISO8601.
How do you read an entry such as
-8:00 | ISO-8601 offset for PST
as being in any way vague about which convention the "-8" is read in?
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ISO8601 vs POSIX offset clarification
@ 2017-12-04 02:59 Bharanee Rathna <deepfryed@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: Bharanee Rathna @ 2017-12-04 02:59 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Sorry I didn't mean for it to come out as a complaint, just that I am
confused since the result of the SQL query was not what I expected. I
expected +11:00 to be 11 hours east of UTC which wasn't the case.
On 4 December 2017 at 13:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Bharanee Rathna <deepfryed@gmail.com> writes:
> > the documentation around how numeric offsets are parsed from strings is a
> > bit confusing, are they supposed to be treated as ISO8601 or POSIX ?
>
> Our documentation about this says clearly that Postgres considers offsets
> to be ISO (positive-east-of-Greenwich) everywhere except in POSIX-style
> time zone names.
>
> > The Table 8-12. Time Zone Input section at
> > https://www.postgresql.org/docs/9.3/static/datatype-datetime.html seems
> to
> > imply that numeric offsets would be treated as ISO8601.
>
> How do you read an entry such as
>
> -8:00 | ISO-8601 offset for PST
>
> as being in any way vague about which convention the "-8" is read in?
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ISO8601 vs POSIX offset clarification
@ 2017-12-04 03:03 Bharanee Rathna <deepfryed@gmail.com>
parent: Bharanee Rathna <deepfryed@gmail.com>
0 siblings, 2 replies; 6+ messages in thread
From: Bharanee Rathna @ 2017-12-04 03:03 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
To be more specific, I expected the output of both these queries to be the
same.
# select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at time
zone '+11:00';
timezone
---------------------
2017-11-30 13:00:00
# select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at time
zone 'Australia/Melbourne';
timezone
---------------------
2017-12-01 11:00:00
Cheers
On 4 December 2017 at 13:59, Bharanee Rathna <deepfryed@gmail.com> wrote:
> Sorry I didn't mean for it to come out as a complaint, just that I am
> confused since the result of the SQL query was not what I expected. I
> expected +11:00 to be 11 hours east of UTC which wasn't the case.
>
>
>
> On 4 December 2017 at 13:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> Bharanee Rathna <deepfryed@gmail.com> writes:
>> > the documentation around how numeric offsets are parsed from strings is
>> a
>> > bit confusing, are they supposed to be treated as ISO8601 or POSIX ?
>>
>> Our documentation about this says clearly that Postgres considers offsets
>> to be ISO (positive-east-of-Greenwich) everywhere except in POSIX-style
>> time zone names.
>>
>> > The Table 8-12. Time Zone Input section at
>> > https://www.postgresql.org/docs/9.3/static/datatype-datetime.html
>> seems to
>> > imply that numeric offsets would be treated as ISO8601.
>>
>> How do you read an entry such as
>>
>> -8:00 | ISO-8601 offset for PST
>>
>> as being in any way vague about which convention the "-8" is read in?
>>
>> regards, tom lane
>>
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ISO8601 vs POSIX offset clarification
@ 2017-12-04 12:07 rob stone <floriparob@gmail.com>
parent: Bharanee Rathna <deepfryed@gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: rob stone @ 2017-12-04 12:07 UTC (permalink / raw)
To: Bharanee Rathna <deepfryed@gmail.com>; pgsql-general@lists.postgresql.org
On Mon, 2017-12-04 at 14:03 +1100, Bharanee Rathna wrote:
> To be more specific, I expected the output of both these queries to
> be the same.
>
> # select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at
> time zone '+11:00';
> timezone
> ---------------------
> 2017-11-30 13:00:00
>
> # select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at
> time zone 'Australia/Melbourne';
> timezone
> ---------------------
> 2017-12-01 11:00:00
>
> Cheers
>
select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at time
zone INTERVAL '+11:00';
Result:-
2017-12-01 11:00:00.0
You need the INTERVAL keyword when using a numeric value instead of a
time zone name. It's in the doco.
The parser ought to throw an error, but it doesn't.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ISO8601 vs POSIX offset clarification
@ 2017-12-04 14:58 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bharanee Rathna <deepfryed@gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: Tom Lane @ 2017-12-04 14:58 UTC (permalink / raw)
To: Bharanee Rathna <deepfryed@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Bharanee Rathna <deepfryed@gmail.com> writes:
> To be more specific, I expected the output of both these queries to be the
> same.
> # select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at time
> zone '+11:00';
> # select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at time
> zone 'Australia/Melbourne';
The +11 in your timestamp input value is per ISO convention, but the
argument of AT TIME ZONE is a zone name, so it follows the POSIX
convention if it's numeric.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2017-12-04 14:58 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-12-04 02:39 ISO8601 vs POSIX offset clarification Bharanee Rathna <deepfryed@gmail.com>
2017-12-04 02:55 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-12-04 02:59 ` Bharanee Rathna <deepfryed@gmail.com>
2017-12-04 03:03 ` Bharanee Rathna <deepfryed@gmail.com>
2017-12-04 12:07 ` rob stone <floriparob@gmail.com>
2017-12-04 14:58 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox