Re: setting time zone in a function - Mailing list pgsql-general

From Tom Lane
Subject Re: setting time zone in a function
Date
Msg-id 11976.1461251982@sss.pgh.pa.us
Whole thread Raw
In response to Re: setting time zone in a function  (Steve Rogerson <steve.pg@yewtc.demon.co.uk>)
List pgsql-general
Steve Rogerson <steve.pg@yewtc.demon.co.uk> writes:
> I wonder what counts as a valid time zone

http://www.postgresql.org/docs/9.5/static/datatype-datetime.html#DATATYPE-TIMEZONES

> ... I wasn't expecting this:

> # set timezone = '==2.77';
> SET
> # select now();
>               now
> -------------------------------
>  2016-04-18 09:40:52.089375-77
> (1 row)

Postgres is *very* lax about what is a valid timezone abbreviation in
the POSIX notation, mainly because the underlying Olson code is too.
I think it's taking that as '==' being the standard zone abbreviation
and '.' being the DST zone abbreviation.

If you wanted to restrict input to be the Olson-style zone names,
you could do some kind of precheck, maybe insist on only letters/
slashes/underscores.

            regards, tom lane


pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Add relcreated (timestamp) column to pg_class catalog to record the time an object was created
Next
From: "David G. Johnston"
Date:
Subject: Re: Add relcreated (timestamp) column to pg_class catalog to record the time an object was created