pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
LOCAL and TIME ZONE in SET
5+ messages / 4 participants
[nested] [flat]

* LOCAL and TIME ZONE in SET
@ 2017-09-08 20:05  zszmigiero@gmail.com
  0 siblings, 1 reply; 5+ messages in thread

From: zszmigiero@gmail.com @ 2017-09-08 20:05 UTC (permalink / raw)
  To: pgsql-docs

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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: LOCAL and TIME ZONE in SET
@ 2017-09-11 15:26  Steve Crawford <scrawford@pinpointresearch.com>
  parent: zszmigiero@gmail.com
  0 siblings, 1 reply; 5+ messages in thread

From: Steve Crawford @ 2017-09-11 15:26 UTC (permalink / raw)
  To: zszmigiero@gmail.com; +Cc: 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 &quot;ALTER DATABASE name TIME ZONE ...&quot; is rejected
>
> THE &quot;ALTER DATABASE name TIMEZONE TO LOCAL&quot; 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

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: LOCAL and TIME ZONE in SET
@ 2017-09-11 16:02  David G. Johnston <david.g.johnston@gmail.com>
  parent: Steve Crawford <scrawford@pinpointresearch.com>
  0 siblings, 0 replies; 5+ messages in thread

From: David G. Johnston @ 2017-09-11 16:02 UTC (permalink / raw)
  To: Steve Crawford <scrawford@pinpointresearch.com>; +Cc: pgsql-docs

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 &quot;ALTER DATABASE name TIME ZONE ...&quot; is rejected
>>
>> THE &quot;ALTER DATABASE name TIMEZONE TO LOCAL&quot; 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
>
>
​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:

https://www.postgresql.org/docs/9.5/static/config-setting.html#CONFIG-SETTING-SQL-COMMAND-INTERACTIO...

David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: LOCAL and TIME ZONE in SET
@ 2017-09-12 19:17  Steve Crawford <scrawford@pinpointresearch.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Steve Crawford @ 2017-09-12 19:17 UTC (permalink / raw)
  To: Zbigniew Szmigiero <zszmigiero@gmail.com>; 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:
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

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: LOCAL and TIME ZONE in SET
@ 2017-09-12 19:43  Zbigniew Szmigiero <zszmigiero@gmail.com>
  parent: Steve Crawford <scrawford@pinpointresearch.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Zbigniew Szmigiero @ 2017-09-12 19:43 UTC (permalink / raw)
  To: Steve Crawford <scrawford@pinpointresearch.com>; +Cc: pgsql-docs

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2017-09-12 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 20:05 LOCAL and TIME ZONE in SET zszmigiero@gmail.com
2017-09-11 15:26 ` Steve Crawford <scrawford@pinpointresearch.com>
2017-09-11 16:02   ` David G. Johnston <david.g.johnston@gmail.com>
2017-09-12 19:17 Re: LOCAL and TIME ZONE in SET Steve Crawford <scrawford@pinpointresearch.com>
2017-09-12 19:43 ` Zbigniew Szmigiero <zszmigiero@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox