Re: BUG #14511: Set timezone to local

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14511: Set timezone to local
Date: 2017-01-24 17:48:06
Message-ID: 68dae0c0-b0b9-d232-9e21-7d577ab3d6d7@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 01/24/2017 09:38 AM, Tom Lane wrote:
> adrian(dot)klaver(at)aklaver(dot)com writes:
>> test=> set timezone = DEFAULT;
>> SET
>
>> test=> set timezone = LOCAL;
>> ERROR: invalid value for parameter "TimeZone": "local"
>
>> test=> set time zone LOCAL;
>> SET
>
> "SET TIME ZONE LOCAL" is a SQL-standard-mandated variant way of writing
> "set timezone to default", following the SQL committee's time-honored
> principle of never using orthogonal syntax if somebody can think of an
> idiosyncratic way instead.
>
> Given the way that our grammar is set up, the only way we could handle
> "set timezone = LOCAL" would be to allow LOCAL as a synonym for DEFAULT
> for *all* SET variables. That doesn't seem like a particularly good
> idea.
>
>> The docs:
>> https://www.postgresql.org/docs/9.5/static/sql-set.html
>> say the last two commands should yield the same result.
>
> AFAICS, the docs show the syntax restriction accurately:
>
> SET [ SESSION | LOCAL ] configuration_parameter { TO | = } { value | 'value' | DEFAULT }
> SET [ SESSION | LOCAL ] TIME ZONE { timezone | LOCAL | DEFAULT }
>
> LOCAL is not listed as a valid alternative for the first syntax.

I did not crawl that far up the page, I stopped at:

SET TIME ZONE value is an alias for SET timezone TO value.

and assumed since LOCAL was valid for the one it was valid for the
other. I should know better:(

>
> regards, tom lane
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2017-01-24 17:48:09 Re: BUG #14512: Backslashes in LIKE
Previous Message David G. Johnston 2017-01-24 17:40:14 Re: BUG #14512: Backslashes in LIKE