From: Viktor Holmberg <v@viktorh.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: ISN extension - wrong volatility level for isn_weak() function
Date: Fri, 14 Mar 2025 16:08:36 +0000
Message-ID: <b698bb0e-766a-4255-a8c2-a1d14ef2a8f5@Spark> (raw)
In-Reply-To: <3074065.1741965229@sss.pgh.pa.us>
References: <ae6ed432-4491-4030-be20-3ea69d03a098@Spark>
<790bc1f9-74dc-4b50-94d2-8147315b1556@Spark>
<51C655A4-46FB-4A40-BAE5-26A76B31D3EE@yesql.se>
<3052531.1741961784@sss.pgh.pa.us>
<de89bd5c-9f51-4891-8a38-d03ed06ebd1d@Spark>
<3074065.1741965229@sss.pgh.pa.us>
Thanks, I did check that thread during my desperate attempts to figure this bug out.
In terms of the ergonomics of is_valid I think it’s actually quite nice. A GUC variable would be very nice - I kinda assumed the ISN module was create before GUC, hence the somewhat idiosyncratic is_weak(bool) session level setting.
However, cleaning things up to use GUC seems like it’d be bigger task, and also would only be an extra thing, as isn_weak function would need to stay in for backwards compatibility I assume.
In terms of just fixing the immediate bug, I believe it’d just be to change isn.sql line 3423 and 2433:
CREATE FUNCTION isn_weak()
RETURNS boolean
AS 'MODULE_PATHNAME', 'weak_input_status'
LANGUAGE C
IMMUTABLE STRICT <— should be VOLATILE STRICT
PARALLEL RESTRICTED;
I believe even I could do this change, unless one of you pros would be open 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? Or does that patch go here? Thanks
/Viktor
On 14 Mar 2025 at 15:14 +0000, Tom Lane <tgl@sss.pgh.pa.us>, wrote:
> Viktor Holmberg <v@viktorh.net> writes:
> > I haven’t checked the source code, but yes the isn_weak feature has some footgun potential. As it doesn’t respect transactions, but rather sets a flag on session level, it’s easy for the “isn weakness” 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/C12AE0A2A752416C79F3EE81%40teje
>
> but we don't seem to have pulled the trigger on changing anything.
>
> regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: v@viktorh.net, tgl@sss.pgh.pa.us, daniel@yesql.se, pgsql-bugs@lists.postgresql.org
Subject: Re: ISN extension - wrong volatility level for isn_weak() function
In-Reply-To: <b698bb0e-766a-4255-a8c2-a1d14ef2a8f5@Spark>
* 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