From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | sundayjiang(蒋浩天) <sundayjiang(at)tencent(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: 回复:[Internet]Re: [PATCH] Prevent replacement of a function if it's used in an index expression and is not IMMUTABLE |
Date: | 2025-07-09 19:05:12 |
Message-ID: | CAKFQuwZD+V-9Tm8OD2Zx6hgvU=f8aQ+xjaD7EhP7OLvc=ZF8BQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jul 9, 2025 at 9:15 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "=?utf-8?B?c3VuZGF5amlhbmco6JKL5rWp5aSpKQ==?=" <sundayjiang(at)tencent(dot)com>
> writes:
> > > The purpose of this patch is to prevent replacing a function via
> `CREATE OR REPLACE FUNCTION` with a new definition that is not marked as
> `IMMUTABLE`, if the existing function is referenced by an index expression.
> > >
> > > Replacing such functions may lead to index corruption or runtime
> semantic inconsistencies, especially when the function’s output is not
> stable for the same input.
>
>
> TBH, I find this proposal to be useless nannyism. Replacing a
> function that is used in an index is problematic if you change its
> behavior (that is, its actual output for given inputs) in any way.
> Whether it's marked IMMUTABLE is a very minor side point.
>
Isn't preventing a dump-restore hazard sufficient reason to do this? The
now-volatile function will be dumped as such and the create index during
the restore will fail because of that.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-07-09 19:07:07 | Re: [PoC] Federated Authn/z with OAUTHBEARER |
Previous Message | Mahendra Singh Thalor | 2025-07-09 18:51:03 | Re: Non-text mode for pg_dumpall |