Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tt7nU-008tyd-DX for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Mar 2025 16:22:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tt7nT-00B8bm-2X for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Mar 2025 16:22:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tt7bM-00AuuO-3b for pgsql-bugs@lists.postgresql.org; Fri, 14 Mar 2025 16:09:36 +0000 Received: from out-03.pe-bsn.jellyfish.systems ([66.29.159.81]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tt7bH-002rUw-1r for pgsql-bugs@lists.postgresql.org; Fri, 14 Mar 2025 16:09:35 +0000 Received: from prod-lbout-phx.jellyfish.systems (bsn-01-5.privateemail.com [198.54.122.103]) by pe-bsn.jellyfish.systems (Postfix) with ESMTPA id 4ZDq7Y203kz2yqF; Fri, 14 Mar 2025 16:09:29 +0000 (UTC) Received: from MTA-11-1.privateemail.com (unknown [10.50.14.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by BSN-01.privateemail.com (Postfix) with ESMTPS id 4ZDq7Y1MNnz3hhTv; Fri, 14 Mar 2025 12:09:29 -0400 (EDT) Received: from mta-11.privateemail.com (localhost [127.0.0.1]) by mta-11.privateemail.com (Postfix) with ESMTP id 4ZDq7Y07cxz3hhTk; Fri, 14 Mar 2025 12:09:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=viktorh.net; s=default; t=1741968569; bh=SuXVVONNwACltKgmhFJeADn7xdSwIsAPgXe58LKl1Ao=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=Iml6QdmHP42O9ujdYLGunTAjM0Z3dy+eLiuHZurItFkNN28JNB7o+zgTA4eY99TEn u95TwGnio+rSIezqr7v3MogQB+C2q+WkheiUBrSBDnLwSEQPSDUVkJ5laji4MAmAWp /39W9XQd1QbhXdYa9h7zHAa2778Gkf2d421J7zvwQX+VGu5om+5J8eXzvbI+nf/8wJ 1n7e2gqm4qyAP3muObFnmF82/Y1vA0TSCiL940isEy35aC7Io+GbIUbarlvZ1uakY1 BcqvYQafkyNpC71MQUPKJQCx8IhOEZyM1BmyMx1dVZ2k8vnoDTbshzWM+ZGOKx09Qh Zj+TtKaFinBog== Received: from vikbook2 (unknown [80.87.18.224]) by mta-11.privateemail.com (Postfix) with ESMTPA; Fri, 14 Mar 2025 12:09:25 -0400 (EDT) Date: Fri, 14 Mar 2025 16:08:36 +0000 From: Viktor Holmberg To: Tom Lane Cc: Daniel Gustafsson , pgsql-bugs@lists.postgresql.org Message-ID: In-Reply-To: <3074065.1741965229@sss.pgh.pa.us> References: <790bc1f9-74dc-4b50-94d2-8147315b1556@Spark> <51C655A4-46FB-4A40-BAE5-26A76B31D3EE@yesql.se> <3052531.1741961784@sss.pgh.pa.us> <3074065.1741965229@sss.pgh.pa.us> Subject: Re: ISN extension - wrong volatility level for isn_weak() function X-Readdle-Message-ID: b698bb0e-766a-4255-a8c2-a1d14ef2a8f5@Spark MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="67d4548e_1f48eaa1_1881" X-Virus-Scanned: ClamAV using ClamSMTP List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --67d4548e_1f48eaa1_1881 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks, I did check that thread during my desperate attempts to figure th= is bug out. In terms of the ergonomics of is=5Fvalid I think it=E2=80=99s actually qu= ite nice. A GUC variable would be very nice - I kinda assumed the ISN mod= ule was create before GUC, hence the somewhat idiosyncratic is=5Fweak(boo= l) session level setting. However, cleaning things up to use GUC seems like it=E2=80=99d be bigger = task, and also would only be an extra thing, as isn=5Fweak function would= need to stay in for backwards compatibility I assume. In terms of just fixing the immediate bug, I believe it=E2=80=99d just be= to change isn.sql line 3423 and 2433: CREATE =46UNCTION isn=5Fweak() RETURNS boolean AS 'MODULE=5FPATHNAME', 'weak=5Finput=5Fstatus' LANGUAGE C IMMUTABLE STRICT <=E2=80=94 should be VOLATILE STRICT PARALLEL RESTRICTED; I believe even I could do this change, unless one of you pros would be op= en to doing it. Am I right in understanding the next steps to do that would be to create = a patch, and email it to pgsql-hackers=3F Or does that patch go here=3F T= hanks /Viktor On 14 Mar 2025 at 15:14 +0000, Tom Lane , wrote: > Viktor Holmberg writes: > > I haven=E2=80=99t checked the source code, but yes the isn=5Fweak fea= ture has some footgun potential. As it doesn=E2=80=99t respect transactio= ns, but rather sets a flag on session level, it=E2=80=99s easy for the =E2= =80=9Cisn weakness=E2=80=9D to leak out into a connection pool. > > Yeah, really that ought to be a GUC I should think. There isn't > anything well-designed about it ... > > I found some prior discussion here: > > https://www.postgresql.org/message-id/flat/C12AE0A2A752416C79=463EE81%4= 0teje > > but we don't seem to have pulled the trigger on changing anything. > > regards, tom lane --67d4548e_1f48eaa1_1881 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Thanks, I= did check that thread during my desperate attempts to figure this bug ou= t.
In terms of the ergonomics of i= s=5Fvalid I think it=E2=80=99s actually quite nice. A GUC variable would = be very nice - I kinda assumed the ISN module was create before GUC, henc= e the somewhat idiosyncratic is=5Fweak(bool) session level setting.

However, cleaning things up to = use GUC seems like it=E2=80=99d be bigger task, and also would only be an= extra thing, as isn=5Fweak function would need to stay in for backwards = compatibility I assume.

In terms of just fixing the imm= ediate bug, I believe it=E2=80=99d just be to change isn.sql line 3423 an= d 2433:

CREATE =46UNCTION isn=5Fweak()
RETURNS boolean
AS 'MODULE=5FPATHNAME', 'weak=5Finpu= t=5Fstatus'
LANGUAGE C
IMMUTABLE STRICT <=E2=80=94 shoul= d be VOLATILE STRICT
PARALLEL RESTRICTED;

I believe even I could do this change, unless one of you pros would be op= en to doing it.&=23160;
Am I right in understanding the next steps to do that would be to create = a patch, and email it to pgsql-hackers=3F Or does that patch go here=3F T= hanks&=23160;

/Viktor
On 14 Mar 2025 at 15:14 +0000, Tom = Lane <tgl=40sss.pgh.pa.us>, wrote:
Viktor Holmberg <v=40viktorh.net> writes:
I haven=E2=80=99t checked the source code, = but yes the isn=5Fweak feature has some footgun potential. As it doesn=E2= =80=99t respect transactions, but rather sets a flag on session level, it= =E2=80=99s easy for the =E2=80=9Cisn weakness=E2=80=9D to leak out into a= connection pool.

Yeah, really that ought to be a GUC I should think. There isn't
anything well-designed about it ...

I found some prior discussion here:

https://www.postgresql.org/message-id/flat/C12AE0A2A752416C79=463EE81%40t= eje

but we don't seem to have pulled the trigger on changing anything.

regards, tom lane
--67d4548e_1f48eaa1_1881--