On Mon, Aug 30, 2021 at 12:58 PM Tom Lane <
tgl@sss.pgh.pa.us> wrote:
>
> Aleksander Alekseev <
aleksander@timescale.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