pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: AviW@gilat.com
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Problematic enforcement of "ERROR: functions in index predicate must be marked IMMUTABLE"
Date: Mon, 10 Jul 2023 21:28:12 -0400
Message-ID: <2417125.1689038892@sss.pgh.pa.us> (raw)
In-Reply-To: <20230711.101429.1932905481648331125.horikyota.ntt@gmail.com>
References: <AS8PR07MB7175A518D1C22D3DB14E318CCB33A@AS8PR07MB7175.eurprd07.prod.outlook.com>
	<20230711.101429.1932905481648331125.horikyota.ntt@gmail.com>

Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> Even given this, premising users keeping the volatility marks in line
> with the actual behavior of their corresponding functions, it might be
> benetifical to prohibit changes to the volatility category while it's
> being used for indices.

Are you going to prohibit changes to the function's behavior, which is
what actually matters?  And if so, how will you enforce that?  Even if
we had an understanding of the function body --- which we generally
don't for PL functions --- determining that would be equivalent to
solving the halting problem.  "Refuse *all* updates to the pg_proc
entry" might sound like a solution; but it is not, because the
function might call another one whose behavior could get changed.

Even granting that we had a useful way to enforce such a restriction,
figuring out whether to apply it would be subject to race conditions;
maybe somebody else is in process of creating an index using the
function that's being altered.

In the end, adding such restrictions would just give a false sense
of security, because there would always be gaps in whatever we did.
As you quote from the documentation, volatility markings are a promise
by the user to the system, not vice versa.  If you break your promise,
you get to keep both pieces of whatever trouble ensues.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <2417125.1689038892@sss.pgh.pa.us>
Permalink:  ../2417125.1689038892@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2417125.1689038892@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, horikyota.ntt@gmail.com, AviW@gilat.com
  Subject: Re: Problematic enforcement of "ERROR: functions in index predicate must be marked IMMUTABLE"
  In-Reply-To: <2417125.1689038892@sss.pgh.pa.us>
  References: <AS8PR07MB7175A518D1C22D3DB14E318CCB33A@AS8PR07MB7175.eurprd07.prod.outlook.com> <20230711.101429.1932905481648331125.horikyota.ntt@gmail.com> <2417125.1689038892@sss.pgh.pa.us>

* 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