On Tue, Sep 12, 2017 at 11:07 AM, Zbigniew Szmigiero <zszmigi...@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:
https://www.postgresql.org/docs/9.6/static/sql-set.html

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

Reply via email to