pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nico Williams <nico@cryptonector.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Olleg Samoylov <splarv@ya.ru>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Interesting case of IMMUTABLE significantly hurting performance
Date: Wed, 9 Apr 2025 16:21:40 -0500
Message-ID: <Z/bk5E6pqIBWTF3j@ubby> (raw)
In-Reply-To: <8687df7d49bc4b28b41c7cf4e9ad1e15d383b2fa.camel@cybertec.at>
References: <662101e2-5ca5-4bf5-9307-2519efde8690@ya.ru>
	<8687df7d49bc4b28b41c7cf4e9ad1e15d383b2fa.camel@cybertec.at>

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
-- 





view thread (20+ messages)  latest in thread

Message-ID: <Z/bk5E6pqIBWTF3j@ubby>
Permalink:  ../Z%2Fbk5E6pqIBWTF3j@ubby/
Also on:    postgresql.org/message-id/Z/bk5E6pqIBWTF3j@ubby

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: nico@cryptonector.com, laurenz.albe@cybertec.at, splarv@ya.ru, pgsql-general@lists.postgresql.org
  Subject: Re: Interesting case of IMMUTABLE significantly hurting performance
  In-Reply-To: <Z/bk5E6pqIBWTF3j@ubby>

* 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