Fix attributes of consume_xids and consume_xids_until
Hi,
I found the attributes of the functions consume_xids and
consume_xids_until are incorrectly specified:
- Both functions are marked as IMMUTABLE attribute, but they advance the
transaction ID, which modifies the system state. Thus, they should be
marked as VOLATILE.
- Additionally, both functions are marked as PARALLEL SAFE. Since these
functions call the AssignTransactionId function, which cannot be invoked
in parallel mode, they should be marked as PARALLEL UNSAFE.
This patch fixes the attributes of consume_xids and consume_xids_until
accordingly.
Best,
Yushi
Attachments:
fix_attr.difftext/x-diff; name=fix_attr.diffDownload
From 601c3510cb77c99abde03722ef72ba77862c40f2 Mon Sep 17 00:00:00 2001
From: Yushi Ogiwara <yushiogiwara@keio.jp>
Date: Fri, 11 Oct 2024 15:07:08 +0900
Subject: [PATCH] fix attr
---
src/test/modules/xid_wraparound/xid_wraparound--1.0.sql | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/modules/xid_wraparound/xid_wraparound--1.0.sql b/src/test/modules/xid_wraparound/xid_wraparound--1.0.sql
index 51d25fc4c6..96356b4b97 100644
--- a/src/test/modules/xid_wraparound/xid_wraparound--1.0.sql
+++ b/src/test/modules/xid_wraparound/xid_wraparound--1.0.sql
@@ -4,9 +4,9 @@
\echo Use "CREATE EXTENSION xid_wraparound" to load this file. \quit
CREATE FUNCTION consume_xids(nxids bigint)
-RETURNS xid8 IMMUTABLE PARALLEL SAFE STRICT
+RETURNS xid8 VOLATILE PARALLEL UNSAFE STRICT
AS 'MODULE_PATHNAME' LANGUAGE C;
CREATE FUNCTION consume_xids_until(targetxid xid8)
-RETURNS xid8 IMMUTABLE PARALLEL SAFE STRICT
+RETURNS xid8 VOLATILE PARALLEL UNSAFE STRICT
AS 'MODULE_PATHNAME' LANGUAGE C;
--
2.40.1
On 11/10/2024 09:59, Yushi Ogiwara wrote:
Hi,
I found the attributes of the functions consume_xids and
consume_xids_until are incorrectly specified:- Both functions are marked as IMMUTABLE attribute, but they advance the
transaction ID, which modifies the system state. Thus, they should be
marked as VOLATILE.
- Additionally, both functions are marked as PARALLEL SAFE. Since these
functions call the AssignTransactionId function, which cannot be invoked
in parallel mode, they should be marked as PARALLEL UNSAFE.This patch fixes the attributes of consume_xids and consume_xids_until
accordingly.
Applied, thanks!
I didn't backpatch this because it's a test module that shouldn't be
installed in production. And because we don't bother with upgrade
scripts for these test modules, it could get confusing.
--
Heikki Linnakangas
Neon (https://neon.tech)