Re: Returning timestamp with timezone at specified timezone irrespective of client timezone - Mailing list pgsql-general

From Jeremy Schneider
Subject Re: Returning timestamp with timezone at specified timezone irrespective of client timezone
Date
Msg-id c870506a-bbae-fa72-c0d5-2f150964a5f8@ardentperf.com
Whole thread Raw
In response to Re: Returning timestamp with timezone at specified timezone irrespective of client timezone  (Jeremy Schneider <schneider@ardentperf.com>)
List pgsql-general
On 9/27/20 20:13, Jeremy Schneider wrote:
> create or replace function to_char(
>    v_tstz timestamp with time zone
>   ,v_format text
>   ,v_tz text
> ) returns text language plpgsql
> immutable parallel safe
> as $$
> begin
>   perform set_config('timezone',v_tz,true);
>   return to_char(v_tstz,v_format);
> end;
> $$
> ;


Just occurred to me, I don't know if this is actually parallel safe. I'm
not sure how transaction-level session configuration is handled inside
parallel workers. Might be best to leave off the "parallel safe" flag
from the function for now.

-J

-- 
http://about.me/jeremy_schneider



pgsql-general by date:

Previous
From: Jeremy Schneider
Date:
Subject: Re: Returning timestamp with timezone at specified timezone irrespective of client timezone
Next
From: Paul Förster
Date:
Subject: Re: pg_upgrade Python version issue on openSUSE