Re: Patch: shouldn't timezone(text, timestamp[tz]) be STABLE?

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Patch: shouldn't timezone(text, timestamp[tz]) be STABLE?
Date: 2021-08-31 17:34:06
Message-ID: CAFBsxsGtW+iNJwOOvKKScYO5WZwsGD=3B35pjULxDbam800ifg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 30, 2021 at 12:58 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Aleksander Alekseev <aleksander(at)timescale(dot)com> writes:
> > Got it. But in this case, what's your opinion on the differences between
> > date_trunc() and timezone()? Shouldn't date_trunc() be always IMMUTABLE
as
> > well?
>
> No, because date_trunc depends on the current timezone setting,
> or at least its stable variants do.

A light bulb went off in my head just now, because I modeled date_bin() in
part on date_trunc(), but apparently it didn't get the memo that the
variant with timezone should have been marked stable.

I believe it's been discussed before that it'd be safer if pg_proc.dat had
the same defaults as CREATE FUNCTION, and this is further evidence for that.

--
John Naylor
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-08-31 17:39:36 Re: Replication slot drop message is sent after pgstats shutdown.
Previous Message Bossart, Nathan 2021-08-31 17:24:49 Re: Pre-allocating WAL files