Re: [DOCS] LOCAL and TIME ZONE in SET - Mailing list pgsql-docs

From Steve Crawford
Subject Re: [DOCS] LOCAL and TIME ZONE in SET
Date
Msg-id CAEfWYywoRpN-c0+kgAn6ZO3zn5M5Z8VYmipnK1435S+FKihsqw@mail.gmail.com
Whole thread Raw
In response to [DOCS] LOCAL and TIME ZONE in SET  (zszmigiero@gmail.com)
Responses Re: [DOCS] LOCAL and TIME ZONE in SET
List pgsql-docs


On Tue, Sep 12, 2017 at 11:07 AM, Zbigniew Szmigiero <zszmigiero@gmail.com> wrote:

Hi Steve,

You do not test syntax provided in my examples:

1. ALTER DATABASE name SET TIME ZONE to ‚timezone’

You used TIMEZONE instead of TIME ZONE - please check
Your examples do not match the documentation. That is why they don't work.

TIME<space>ZONE is a special case as detailed at the top of:

Specifically, for "time zone" there is no "to" between "time zone" and the zone name but "local" is a special-case allowed option which is not one of the options for configuration parameters (local would not make sense for most configuration parameters while default usually does).

But "timezone" (no space) is a configuration parameter and *does* require the "to".

Won't work:

steve=# alter database steve set timezone local;
ERROR:  syntax error at or near "local"
LINE 1: alter database steve set timezone local;
                                         ^
steve=# alter database steve set time zone to local;
ERROR:  syntax error at or near "to"
LINE 1: alter database steve set time zone to local;

steve=# alter database steve set timezone 'US/Eastern';    
ERROR:  syntax error at or near "'US/Eastern'"
LINE 1: alter database steve set timezone 'US/Eastern';

steve=# alter database steve set timezone to 'local';
ERROR:  invalid value for parameter "TimeZone": "local"

Will work:

steve=# alter database steve set time zone 'US/Eastern';
ALTER DATABASE

steve=# alter database steve set time zone local;        
ALTER DATABASE

steve=# alter database steve set time zone default;
ALTER DATABASE

steve=# alter database steve set timezone to 'US/Eastern';
ALTER DATABASE 

steve=# alter database steve set timezone to default;
ALTER DATABASE

2. ALTER DATABASE name SET TIMEZONE TO LOCAL generates error - my pg is 9.5.9, please do that with correct privileges, your account was not able execute it.

I know - I was just showing both the privileged and unprivileged attempts.

Cheers,
Steve

pgsql-docs by date:

Previous
From: devvapp@gmail.com
Date:
Subject: [DOCS] Incorrect result in the Table 9-28. to_char examples
Next
From: Zbigniew Szmigiero
Date:
Subject: Re: [DOCS] LOCAL and TIME ZONE in SET