Steve Rogerson 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
> ---
> 201
On 21/04/16 14:47, Tom Lane wrote:
> Steve Rogerson writes:
>> I want the time zone if a function a bit like ...
>> CREATE OR REPLACE FUNCTION
>>short_name (timestamp with time zone, varchar) RETURNS varchar AS $$
>> DECLARE
>> ...
>> BEGIN
>> SET LOCAL TIME ZONE $2;
Steve Rogerson writes:
> I want the time zone if a function a bit like ...
> CREATE OR REPLACE FUNCTION
>short_name (timestamp with time zone, varchar) RETURNS varchar AS $$
> DECLARE
> ...
> BEGIN
> SET LOCAL TIME ZONE $2;
Nope, that won't work: in general you can't
I want the time zone if a function a bit like ...
CREATE OR REPLACE FUNCTION
short_name (timestamp with time zone, varchar) RETURNS varchar AS $$
DECLARE
...
BEGIN
SET LOCAL TIME ZONE $2;
SELECT to_char($1, 'TZ')::varchar
...
END $$
LANGUAGE 'plpgsq