回复:[Internet]Re: Re: 回复:Re: [PATCH] Pr event replacement of a function if it's used in an index expression and is not IMMUTABLE

From: sundayjiang(蒋浩天) <sundayjiang(at)tencent(dot)com>
To: David G(dot) Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: 回复:[Internet]Re: Re: 回复:Re: [PATCH] Pr event replacement of a function if it's used in an index expression and is not IMMUTABLE
Date: 2025-07-11 02:46:13
Message-ID: tencent_52BEF422471AF3D3113ED03D@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear&nbsp;David,

Thank&nbsp;you&nbsp;very&nbsp;much&nbsp;for&nbsp;your&nbsp;feedback&nbsp;and&nbsp;clarification.

We&nbsp;now&nbsp;realize&nbsp;that&nbsp;the&nbsp;current&nbsp;immutability&nbsp;mechanism&nbsp;in&nbsp;PostgreSQL&nbsp;has&nbsp;been&nbsp;established&nbsp;for&nbsp;a&nbsp;long&nbsp;time,&nbsp;and&nbsp;changing&nbsp;it&nbsp;at&nbsp;this&nbsp;point&nbsp;would&nbsp;not&nbsp;only&nbsp;be&nbsp;difficult&nbsp;but&nbsp;also&nbsp;risk&nbsp;breaking&nbsp;backward&nbsp;compatibility.

We&nbsp;appreciate&nbsp;your&nbsp;insights&nbsp;regarding&nbsp;the&nbsp;implications&nbsp;and&nbsp;trade-offs.&nbsp;We&nbsp;are&nbsp;now&nbsp;exploring&nbsp;alternative&nbsp;ways&nbsp;to&nbsp;address&nbsp;this&nbsp;issue&nbsp;within&nbsp;our&nbsp;specific&nbsp;use&nbsp;case,&nbsp;possibly&nbsp;via&nbsp;external&nbsp;tooling&nbsp;or&nbsp;extension-level&nbsp;enforcement.

If&nbsp;we&nbsp;find&nbsp;a&nbsp;more&nbsp;viable&nbsp;solution&nbsp;that&nbsp;balances&nbsp;compatibility&nbsp;and&nbsp;safety,&nbsp;we’d&nbsp;be&nbsp;happy&nbsp;to&nbsp;discuss&nbsp;it&nbsp;further&nbsp;with&nbsp;the&nbsp;community.

Thanks&nbsp;again&nbsp;for&nbsp;your&nbsp;time&nbsp;and&nbsp;guidance.

Best&nbsp;regards,
xiaojiluo(tencent security yunding lab), sundayjiang(tencent security yunding&nbsp;Lab)

David G. Johnston<david(dot)g(dot)johnston(at)gmail(dot)com&gt;&nbsp;在 2025年7月10日 周四 21:14 写道:

On Wednesday, July 9, 2025, sundayjiang(蒋浩天) <sundayjiang(at)tencent(dot)com&gt; wrote:

&nbsp; &nbsp; - When creating a function, if it is declared as IMMUTABLE but directly calls a non-IMMUTABLE function, the creation should be rejected.

This patch is not going to be accepted in core.&nbsp; In short, your desire to have the server enforce this is too late.&nbsp; We don’t get to change our policy.

The alter function + index is at least reasonable since it affects a dump-restore scenario; but was deemed too expensive for the benefit.&nbsp; Arguably we should just get rid of the immutability check for create index since our enforcement of it has so many holes.

David J.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-07-11 02:53:28 Re: Adding some error context for lock wait failures
Previous Message Zhang Mingli 2025-07-11 02:44:11 Re: Adding some error context for lock wait failures