LOCAL and TIME ZONE in SET
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/9.5/static/sql-alterdatabase.html
Description:
The "ALTER DATABASE name TIME ZONE ..." is rejected
THE "ALTER DATABASE name TIMEZONE TO LOCAL" is rejected
Please update documentation or provide correct syntax
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
On Fri, Sep 8, 2017 at 1:05 PM, <zszmigiero@gmail.com> wrote:
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/9.5/static/sql-alterdatabase.html
Description:The "ALTER DATABASE name TIME ZONE ..." is rejected
THE "ALTER DATABASE name TIMEZONE TO LOCAL" is rejected
Please update documentation or provide correct syntax
It works as described in the documentation:
steve=> alter database steve set timezone to local;
ERROR: must be owner of database steve
postgres=# alter database steve set timezone to 'US/Pacific';
ALTER DATABASE
postgres=# alter database steve set timezone to default;
ALTER DATABASE
Cheers,
Steve
On Mon, Sep 11, 2017 at 8:26 AM, Steve Crawford <
scrawford@pinpointresearch.com> wrote:
On Fri, Sep 8, 2017 at 1:05 PM, <zszmigiero@gmail.com> wrote:
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/9.5/static/sql-alterdatabase.html
Description:The "ALTER DATABASE name TIME ZONE ..." is rejected
THE "ALTER DATABASE name TIMEZONE TO LOCAL" is rejected
Please update documentation or provide correct syntax
It works as described in the documentation:
steve=> alter database steve set timezone to local;
ERROR: must be owner of database stevepostgres=# alter database steve set timezone to 'US/Pacific';
ALTER DATABASE
postgres=# alter database steve set timezone to default;
ALTER DATABASE
More specifically the first listed syntax only applies if the inherent
database "option" you wish to set is one of:
ALLOW_CONNECTIONS allowconn
CONNECTION LIMIT connlimit
IS_TEMPLATE istemplate
What you want to do is setup a default User-Database Configuration (GUC)
value (which in this case applies to all users connecting to this
database); which is what the last 4 syntax specifications pertain to - as
noted in the description section on that page.
18.1.3 describes this dynamic in more detail:
David J.
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:
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
Import Notes
Reply to msg id not found: 8633F289-E123-4F43-A381-FF98B41C3244@gmail.comReference msg id not found: 69E56BAD-CB6E-49BD-901F-63573AC0EF18@gmail.comReference msg id not found: 8633F289-E123-4F43-A381-FF98B41C3244@gmail.com | Resolved by subject fallback
Hi,
Thanks for explanation.
Some information from my side. I am working on tool which create randomized SQL stream which covers all possible syntaxes for many different databases.
The reason to do that is have possibility to check SQL parsing by DAM (Database activity monitoring) tools like Guardium, Imperva.
I am incorrectly read syntax, now everything is clear.
Best wishes,
Zibi
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs