This is similar to these questions:
- Why does PostgreSQL interpret numeric UTC offset as POSIX and not ISO-8601?
- Strange UTC offset time zone parsing in Postgres
I'm running Postgres 10.3. As per the docs, many time zone descriptors are interpreted as POSIX, which calculates negative offsets east of UTC while ISO 8601 interprets negative offsets west of UTC. But then this:
SET TIME ZONE '-7';
SHOW TIME ZONE;
>> <-07>+07
SELECT NOW();
>> 2018-09-26 12:00:20.309182-07
SELECT NOW() AT TIME ZONE 'America/Los_Angeles'
>> 2018-09-26 12:00:22.445955
SELECT NOW() AT TIME ZONE '-7'
>> 2018-09-27 02:00:27.862773
It appears that '-7' is interpreted as ISO 8601 when used in SET TIME ZONE '-7'
and as POSIX when used in AT TIME ZONE '-7'
.
Is there a reason for this? Is it documented somewhere?