Re: Returning timestamp with timezone at specified timezone irrespective of client timezone

From: Jeremy Schneider <schneider(at)ardentperf(dot)com>
To: Ron <ronljohnsonjr(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Returning timestamp with timezone at specified timezone irrespective of client timezone
Date: 2020-09-28 03:26:42
Message-ID: c870506a-bbae-fa72-c0d5-2f150964a5f8@ardentperf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Förster 2020-09-28 07:46:52 Re: pg_upgrade Python version issue on openSUSE
Previous Message Jeremy Schneider 2020-09-28 03:13:25 Re: Returning timestamp with timezone at specified timezone irrespective of client timezone