pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeremy Schneider <schneider@ardentperf.com>
To: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Returning timestamp with timezone at specified timezone irrespective of client timezone
Date: Sun, 27 Sep 2020 20:26:42 -0700
Message-ID: <c870506a-bbae-fa72-c0d5-2f150964a5f8@ardentperf.com> (raw)
In-Reply-To: <4199d0ba-564d-c8a1-5d34-17cf06e022bc@ardentperf.com>
References: <3af9fdd2-b622-426a-8e1e-aeab1bee8493@www.fastmail.com>
	<6b269cb9-5572-acaa-de9c-fe1c705fed11@gmail.com>
	<f6e2b173-1a48-dfeb-0cb9-fe10dd0b965d@ardentperf.com>
	<4199d0ba-564d-c8a1-5d34-17cf06e022bc@ardentperf.com>

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





view thread (14+ messages)  latest in thread

Message-ID: <c870506a-bbae-fa72-c0d5-2f150964a5f8@ardentperf.com>
Permalink:  ../c870506a-bbae-fa72-c0d5-2f150964a5f8@ardentperf.com/
Also on:    postgresql.org/message-id/c870506a-bbae-fa72-c0d5-2f150964a5f8@ardentperf.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: schneider@ardentperf.com, ronljohnsonjr@gmail.com
  Subject: Re: Returning timestamp with timezone at specified timezone irrespective of client timezone
  In-Reply-To: <c870506a-bbae-fa72-c0d5-2f150964a5f8@ardentperf.com>
  References: <3af9fdd2-b622-426a-8e1e-aeab1bee8493@www.fastmail.com> <6b269cb9-5572-acaa-de9c-fe1c705fed11@gmail.com> <f6e2b173-1a48-dfeb-0cb9-fe10dd0b965d@ardentperf.com> <4199d0ba-564d-c8a1-5d34-17cf06e022bc@ardentperf.com> <c870506a-bbae-fa72-c0d5-2f150964a5f8@ardentperf.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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