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 1tt4fN-008JJl-NE for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Mar 2025 13:01:33 +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 1tt4fM-006q2w-ET for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Mar 2025 13:01:32 +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 1tt3Xm-005Dhl-MT for pgsql-bugs@lists.postgresql.org; Fri, 14 Mar 2025 11:49:38 +0000 Received: from out-02.pe-bsn.jellyfish.systems ([66.29.159.80]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tt3Xh-002pQK-36 for pgsql-bugs@lists.postgresql.org; Fri, 14 Mar 2025 11:49:38 +0000 Received: from prod-lbout-phx.jellyfish.systems (bsn-02-6.privateemail.com [198.54.118.197]) by pe-bsn.jellyfish.systems (Postfix) with ESMTPA id 4ZDjMc68rcz30JH for ; Fri, 14 Mar 2025 11:49:32 +0000 (UTC) Received: from MTA-10-1.privateemail.com (unknown [10.50.14.20]) (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-02.privateemail.com (Postfix) with ESMTPS id 4ZDjMc5cvlz3hhTh for ; Fri, 14 Mar 2025 07:49:32 -0400 (EDT) Received: from mta-10.privateemail.com (localhost [127.0.0.1]) by mta-10.privateemail.com (Postfix) with ESMTP id 4ZDjMc4HHyz3hhcc for ; Fri, 14 Mar 2025 07:49:32 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=viktorh.net; s=default; t=1741952972; bh=Z9+aWSQb5RyZT277ophHqFs/lFy0sNheCQsWj4BCGd0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=WFcvP4iDLQDSbTY1so2e2BuzeKVsjOcSKT23sAPgSRlU8bmxYhj3a/5JaqYQ7OyGK w+1adzJWJsKQzt0Qc3KzBwKHsJ6uIqXwQYDXrMqcYLCng2es/6Hk5LC4b/Pknl8afr blxcXK6Ph3MgoE/eJh4JRXd/VxlCTPfpExlBvLuWbvkxUaINR2Xej23wW27HX2rHrr Sk6JP9u5muca9jID9sOm6WTe5D15AouryqX2EE4yEn4tCn6QvBRilHSi9nZ2ZqFF8v J3d663Z4s/38aX4BsaHYqdpcwJOkfBo6ao3KiOIGCWgXoUY1kwMRJw3bXB96AclXwW HMwIW26F0Bqfw== Received: from [10.34.123.152] (unknown [80.87.18.224]) by mta-10.privateemail.com (Postfix) with ESMTPA for ; Fri, 14 Mar 2025 07:49:18 -0400 (EDT) Date: Fri, 14 Mar 2025 11:49:06 +0000 From: Viktor Holmberg To: pgsql-bugs@lists.postgresql.org Message-ID: <790bc1f9-74dc-4b50-94d2-8147315b1556@Spark> In-Reply-To: References: Subject: ISN extension - wrong volatility level for isn_weak() function X-Readdle-Message-ID: 790bc1f9-74dc-4b50-94d2-8147315b1556@Spark MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="67d417ba_2ca88611_1881" X-Virus-Scanned: ClamAV using ClamSMTP List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --67d417ba_2ca88611_1881 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello. Apologies if this is not the right place to bug report extensions,= but I couldn=E2=80=99t find a better place. An at the very least I=E2=80= =99d like to save someone a day of debugging this issue. The isn=5Fweak function in the isn extension reports the wrong value if y= ou look at it inside a transaction: BEGIN; -- Prepare a statement for isn=5Fweak(): PREPARE s=5F1 AS =C2=A0SELECT isn=5Fweak() AS prepared=5Fcheck; -- =46irst check - locks in the isn=5Fweak value EXECUTE s=5F1; -- =3D> =46ALSE -- Set isn=5Fweak(true): SELECT isn=5Fweak(true) AS setting=5Ftrue; -- Check using normal query: SELECT isn=5Fweak() AS direct=5Fcheck; -- =3D> TRUE EXECUTE s=5F1; -- =3D> =46ALSE (=21=21=21=21) This is because by default, that function is marked as immutable: d6kpcv43m9du6> =5Cdf+ isn=5Fweak List of functions =E2=94=80=5B RECORD 1 =5D=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80 Schema =E2=94=82 public Name =E2=94=82 isn=5Fweak Result data type =E2=94=82 boolean Argument data types =E2=94=82 Type =E2=94=82 func Volatility =E2=94=82 immutable <=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94 bad Parallel =E2=94=82 restricted Owner =E2=94=82 postgres Security =E2=94=82 invoker Access privileges =E2=94=82 Language =E2=94=82 c Internal name =E2=94=82 weak=5Finput=5Fstatus I can manually fix this by changing it to STABLE: ALTER =46UNCTION isn=5Fweak() STABLE; Am I missing something or isn=E2=80=99t this quite weird=3F Would it at l= east be possible to change the documentation to explain this=3F /Viktor Holmberg --67d417ba_2ca88611_1881 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hello. Apologies if this is not the right place to = bug report extensions, but I couldn=E2=80=99t find a better place. An at = the very least I=E2=80=99d like to save someone a day of debugging this i= ssue.

The isn=5Fweak function in the isn extension reports the wrong value if y= ou look at it inside a transaction:

BEGIN;

-- Prepare a statement for isn=5Fweak():
PREPARE s=5F1 AS
&=23160;SELECT isn=5Fweak() AS prepared=5Fcheck;

-- =46irst check - locks in the isn=5Fweak value
EXECUTE s=5F1; -- =3D> =46ALSE

-- Set isn=5Fweak(true):
SELECT isn=5Fweak(true) AS setting=5Ftrue;

-- Check using normal query:
SELECT isn=5Fweak() AS direct=5Fcheck; -- =3D> TRUE

EXECUTE s=5F1; -- =3D> =46ALSE (=21=21=21=21)

This is because by default, that function is marked as immutable:

d6kpcv43m9du6> =5Cdf+ isn=5Fweak
List of functions
=E2=94=80=5B RECORD 1 =5D=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80
Schema =E2=94=82 public
Name =E2=94=82 isn=5Fweak
Result data type =E2=94=82 boolean
Argument data types =E2=94=82
Type =E2=94=82 func
Volatility =E2=94=82 immutable <=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94 bad
Parallel =E2=94=82 restricted
Owner =E2=94=82 postgres
Security =E2=94=82 invoker
Access privileges =E2=94=82
Language =E2=94=82 c
Internal name =E2=94=82 weak=5Finput=5Fstatus

I can manually fix this by changing it to STABLE:

ALTER =46UNCTION isn=5Fweak() STABLE;

Am I missing something or isn=E2=80=99t this quite weird=3F Would it at l= east be possible to change the documentation to explain this=3F

/Viktor Holmberg
--67d417ba_2ca88611_1881--