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:30:15 |
Message-ID: | CAKFQuwZgNKvb4Oref9n6aUywqne-BrH+RHDFW9ZN0c+t2uuDtA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jul 9, 2025 at 12:11 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Wed, Jul 9, 2025 at 9:15 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> TBH, I find this proposal to be useless nannyism.
>
> > Isn't preventing a dump-restore hazard sufficient reason to do this?
>
> No, I don't think so. If you're not being very careful about revising
> functions used in indexes, you are going to have problems a lot sooner
> than some future dump/restore cycle.
>
>
Then probably this patch can just update the create index documentation to
say "create or replace it" instead of just "create it". The fact that
during 'update' (replace) existing non-implied settings can be replaced
with implied ones is a beginner/inattentive foot-gun. We do make the point
clearly in create function but it seems worthwhile to reinforce it here too.
"To use a user-defined function in an index expression or WHERE clause,
remember to mark the function immutable when you create [or replace] it."
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2025-07-09 19:42:26 | Re: Adding basic NUMA awareness |
Previous Message | Jacob Champion | 2025-07-09 19:28:52 | Re: [PoC] Federated Authn/z with OAUTHBEARER |