contrib/isn: Make weak mode a GUC setting, and fix related functions.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 44890442398cf3a65230d53167e61905d2b0d348
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2025-03-16T17:45:48Z
Releases: 18.0
contrib/isn: Make weak mode a GUC setting, and fix related functions.

isn's weak mode used to be a simple static variable, settable only
via the isn_weak(boolean) function.  This wasn't optimal, as this
means it doesn't respect transactions nor respond to RESET ALL.

This patch makes isn.weak a GUC parameter instead, so that
it acts like any other user-settable parameter.

The isn_weak() functions are retained for backwards compatibility.
But we must fix their volatility markings: they were marked IMMUTABLE
which is surely incorrect, and PARALLEL RESTRICTED which isn't right
for GUC-related functions either.  Mark isn_weak(boolean) as
VOLATILE and PARALLEL UNSAFE, matching set_config().  Mark isn_weak()
as STABLE and PARALLEL SAFE, matching current_setting().

Reported-by: Viktor Holmberg <v@viktorh.net>
Diagnosed-by: Daniel Gustafsson <daniel@yesql.se>
Author: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/790bc1f9-74dc-4b50-94d2-8147315b1556@Spark

Files

PathChange+/−
contrib/isn/expected/isn.out modified +44 −0
contrib/isn/isn--1.2--1.3.sql added +7 −0
contrib/isn/isn.c modified +21 −6
contrib/isn/isn.control modified +1 −1
contrib/isn/isn.h modified +0 −1
contrib/isn/Makefile modified +2 −2
contrib/isn/meson.build modified +2 −1
contrib/isn/sql/isn.sql modified +13 −0
doc/src/sgml/isn.sgml modified +47 −24

Documentation touched

Discussion