From 2bed6878bbc0a7b0e2a9dda0cdd1b542342cc0e1 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Tue, 8 Sep 2026 14:47:00 +0900
Subject: [PATCH v1] Mark GUC-dependent type output functions as STABLE

byteaout and pg_mcv_list_out depend on bytea_output GUC, while
float4out, float8out, and the geometric type output functions depend
on extra_float_digits GUC. The BRIN minmax-multi summary output
function also calls the summarized type's output function, so its result
can depend on the type's output settings.

Mark these functions STABLE instead of IMMUTABLE to reflect their
dependence on session settings. This prevents them from being used in
expressions that require immutability, such as expression indexes,
generated columns, and partition keys.
---
 src/include/catalog/pg_proc.dat | 46 ++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 960763ee50b..7f54f92b553 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -49,8 +49,8 @@
   proname => 'byteain', prorettype => 'bytea', proargtypes => 'cstring',
   prosrc => 'byteain' },
 { oid => '31', descr => 'I/O',
-  proname => 'byteaout', prorettype => 'cstring', proargtypes => 'bytea',
-  prosrc => 'byteaout' },
+  proname => 'byteaout', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'bytea', prosrc => 'byteaout' },
 { oid => '1245', descr => 'I/O',
   proname => 'charin', prorettype => 'char', proargtypes => 'cstring',
   prosrc => 'charin' },
@@ -349,26 +349,26 @@
   proname => 'point_in', prorettype => 'point', proargtypes => 'cstring',
   prosrc => 'point_in' },
 { oid => '118', descr => 'I/O',
-  proname => 'point_out', prorettype => 'cstring', proargtypes => 'point',
-  prosrc => 'point_out' },
+  proname => 'point_out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'point', prosrc => 'point_out' },
 { oid => '119', descr => 'I/O',
   proname => 'lseg_in', prorettype => 'lseg', proargtypes => 'cstring',
   prosrc => 'lseg_in' },
 { oid => '120', descr => 'I/O',
-  proname => 'lseg_out', prorettype => 'cstring', proargtypes => 'lseg',
-  prosrc => 'lseg_out' },
+  proname => 'lseg_out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'lseg', prosrc => 'lseg_out' },
 { oid => '121', descr => 'I/O',
   proname => 'path_in', prorettype => 'path', proargtypes => 'cstring',
   prosrc => 'path_in' },
 { oid => '122', descr => 'I/O',
-  proname => 'path_out', prorettype => 'cstring', proargtypes => 'path',
-  prosrc => 'path_out' },
+  proname => 'path_out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'path', prosrc => 'path_out' },
 { oid => '123', descr => 'I/O',
   proname => 'box_in', prorettype => 'box', proargtypes => 'cstring',
   prosrc => 'box_in' },
 { oid => '124', descr => 'I/O',
-  proname => 'box_out', prorettype => 'cstring', proargtypes => 'box',
-  prosrc => 'box_out' },
+  proname => 'box_out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'box', prosrc => 'box_out' },
 { oid => '125',
   proname => 'box_overlap', prorettype => 'bool', proargtypes => 'box box',
   prosrc => 'box_overlap' },
@@ -587,8 +587,8 @@
   proname => 'float4in', prorettype => 'float4', proargtypes => 'cstring',
   prosrc => 'float4in' },
 { oid => '201', descr => 'I/O',
-  proname => 'float4out', prorettype => 'cstring', proargtypes => 'float4',
-  prosrc => 'float4out' },
+  proname => 'float4out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'float4', prosrc => 'float4out' },
 { oid => '202',
   proname => 'float4mul', prorettype => 'float4',
   proargtypes => 'float4 float4', prosrc => 'float4mul' },
@@ -628,8 +628,8 @@
   proname => 'float8in', prorettype => 'float8', proargtypes => 'cstring',
   prosrc => 'float8in' },
 { oid => '215', descr => 'I/O',
-  proname => 'float8out', prorettype => 'cstring', proargtypes => 'float8',
-  prosrc => 'float8out' },
+  proname => 'float8out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'float8', prosrc => 'float8out' },
 { oid => '216',
   proname => 'float8mul', prorettype => 'float8',
   proargtypes => 'float8 float8', prosrc => 'float8mul' },
@@ -995,8 +995,8 @@
   proname => 'poly_in', prorettype => 'polygon', proargtypes => 'cstring',
   prosrc => 'poly_in' },
 { oid => '348', descr => 'I/O',
-  proname => 'poly_out', prorettype => 'cstring', proargtypes => 'polygon',
-  prosrc => 'poly_out' },
+  proname => 'poly_out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'polygon', prosrc => 'poly_out' },
 
 { oid => '350', descr => 'less-equal-greater',
   proname => 'btint2cmp', proleakproof => 't', prorettype => 'int4',
@@ -3215,8 +3215,8 @@
   proname => 'circle_in', prorettype => 'circle', proargtypes => 'cstring',
   prosrc => 'circle_in' },
 { oid => '1451', descr => 'I/O',
-  proname => 'circle_out', prorettype => 'cstring', proargtypes => 'circle',
-  prosrc => 'circle_out' },
+  proname => 'circle_out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'circle', prosrc => 'circle_out' },
 { oid => '1452',
   proname => 'circle_same', prorettype => 'bool',
   proargtypes => 'circle circle', prosrc => 'circle_same' },
@@ -3337,8 +3337,8 @@
   proname => 'line_in', prorettype => 'line', proargtypes => 'cstring',
   prosrc => 'line_in' },
 { oid => '1491', descr => 'I/O',
-  proname => 'line_out', prorettype => 'cstring', proargtypes => 'line',
-  prosrc => 'line_out' },
+  proname => 'line_out', provolatile => 's', prorettype => 'cstring',
+  proargtypes => 'line', prosrc => 'line_out' },
 { oid => '1492',
   proname => 'line_eq', prorettype => 'bool', proargtypes => 'line line',
   prosrc => 'line_eq' },
@@ -5534,7 +5534,7 @@
   proname => 'pg_mcv_list_in', prorettype => 'pg_mcv_list',
   proargtypes => 'cstring', prosrc => 'pg_mcv_list_in' },
 { oid => '5019', descr => 'I/O',
-  proname => 'pg_mcv_list_out', prorettype => 'cstring',
+  proname => 'pg_mcv_list_out', provolatile => 's', prorettype => 'cstring',
   proargtypes => 'pg_mcv_list', prosrc => 'pg_mcv_list_out' },
 { oid => '5020', descr => 'I/O',
   proname => 'pg_mcv_list_recv', provolatile => 's',
@@ -12625,8 +12625,8 @@
   prorettype => 'pg_brin_minmax_multi_summary', proargtypes => 'cstring',
   prosrc => 'brin_minmax_multi_summary_in' },
 { oid => '4639', descr => 'I/O',
-  proname => 'brin_minmax_multi_summary_out', prorettype => 'cstring',
-  proargtypes => 'pg_brin_minmax_multi_summary',
+  proname => 'brin_minmax_multi_summary_out', provolatile => 's',
+  prorettype => 'cstring', proargtypes => 'pg_brin_minmax_multi_summary',
   prosrc => 'brin_minmax_multi_summary_out' },
 { oid => '4640', descr => 'I/O',
   proname => 'brin_minmax_multi_summary_recv', provolatile => 's',
-- 
2.55.0

