Re: Interesting case of IMMUTABLE significantly hurting performance - Mailing list pgsql-general

From Nico Williams
Subject Re: Interesting case of IMMUTABLE significantly hurting performance
Date
Msg-id Z/bk5E6pqIBWTF3j@ubby
Whole thread Raw
In response to Re: Interesting case of IMMUTABLE significantly hurting performance  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Interesting case of IMMUTABLE significantly hurting performance
List pgsql-general
On Wed, Apr 09, 2025 at 10:50:00PM +0200, Laurenz Albe wrote:
> The IMMUTABLE function cannot be inlined because to_char() is not IMMUTABLE.

Q: Why would to_char() not be IMMUTABLE?

A: Because it makes use of locales, and I guess the guc-timezone GUC,
   which could change if the expression is ultimately used in a PlPgSQL
   fragment, or if it's in a prepared statement.  (I think.)

That to_char is not immutable is not documented though.  Though it's
clear when looking at the docs for the `jsonb_.*_tz()` functions.

Nico
-- 



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Interesting case of IMMUTABLE significantly hurting performance
Next
From: Adrian Klaver
Date:
Subject: Re: Interesting case of IMMUTABLE significantly hurting performance