On Thu, Mar 12, 2026, at 11:07 AM, Tom Lane wrote:
> "Greg Burd" <[email protected]> writes:
>> errfinish+0x288(1008310c9, 70f, 100832730, 100bff148, 100bff208, 0)
>> ...
>> aclitemout+0xf4(100cfa668, 1, 0, 100cfa10f, 100cfa600, 100cf9960)
>> FunctionCall1Coll+0x2c(100cfa120, 0, 100cfa600, 0, 100cfa10f, 7)
>> array_out+0x700(2, 0, 100cfa610, 100cfa650, 100cfa638, 0)
>> FunctionCall1Coll+0x2c(ffffffff7fffed00, 0, 100cfa5e8, 0, 100bff150, 2ef)
>> OidOutputFunctionCall+0x18(2ef, 100cfa5e8, 409, 100c01150, 100, 
>> ffffffff7fffed00)
>> InsertOneValue+0x2a4(100cfa058, e8, 1009a6f60, 100ccdb84, 40a, 100be5388)
>
> Oh ... you are running it at max debug level, aren't you.
> So InsertOneValue tries to print out the inserted value,
> and that doesn't work because I didn't hot-wire aclitemout
> for bootstrap mode, only aclitemin.

Hey Tom,

I'm not sure what "hot-wire" means, but I put a quick patch together that sets 
it to NULL when bootstrapping for now.  I'm building and testing now with the 
*three* patches, hopefully it'll complete in < 4hrs.

> I'm away on vacation, but will fix that when I return.
> In the meantime, backing down initdb's debug level to
> something less than DEBUG4 should get you past that.

Enjoy the vacation, please ignore me and this issue until you get back.  The 
tests might be done by then...

best.

-greg

>                       regards, tom lane
From c794617fd1684bb6ba23e610f09435704ce6e03d Mon Sep 17 00:00:00 2001
From: Tom Lane <[email protected]>
Date: Thu, 12 Mar 2026 14:37:26 -0400
Subject: [PATCH v20260312c 1/3] Restore PS_USE_CHANGE_ARGV for Solaris

The PS_USE_CHANGE_ARGV mode removed by d2ea2d310 was the right approach
for Solaris/Illumos.  The pre-existing code selected it via
"(defined(BSD) || defined(__hurd__)) && !defined(__darwin__)", but "BSD"
is not predefined on modern Solaris.  Select it with "defined(__sun)"
instead.

Discussion: https://postgr.es/m/[email protected]
---
 src/backend/utils/misc/ps_status.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c
index 51dce24947a..41da351d01d 100644
--- a/src/backend/utils/misc/ps_status.c
+++ b/src/backend/utils/misc/ps_status.c
@@ -39,6 +39,9 @@ bool		update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
  * PS_USE_SETPROCTITLE
  *	   use the function setproctitle(const char *, ...)
  *	   (other BSDs)
+ * PS_USE_CHANGE_ARGV
+ *	   assign argv[0] = "string"
+ *	   (Solaris)
  * PS_USE_CLOBBER_ARGV
  *	   write over the argv and environment area
  *	   (Linux and most SysV-like systems)
@@ -52,7 +55,9 @@ bool		update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
 #define PS_USE_SETPROCTITLE_FAST
 #elif defined(HAVE_SETPROCTITLE)
 #define PS_USE_SETPROCTITLE
-#elif defined(__linux__) || defined(_AIX) || defined(__sun) || defined(__darwin__) || defined(__GNU__)
+#elif defined(__sun)
+#define PS_USE_CHANGE_ARGV
+#elif defined(__linux__) || defined(_AIX) || defined(__darwin__) || defined(__GNU__)
 #define PS_USE_CLOBBER_ARGV
 #elif defined(WIN32)
 #define PS_USE_WIN32
@@ -223,6 +228,9 @@ save_ps_display_args(int argc, char **argv)
 		ps_status_new_environ = new_environ;
 #endif
 	}
+#endif							/* PS_USE_CLOBBER_ARGV */
+
+#if defined(PS_USE_CHANGE_ARGV) || defined(PS_USE_CLOBBER_ARGV)
 
 	/*
 	 * If we're going to change the original argv[] then make a copy for
@@ -268,7 +276,7 @@ save_ps_display_args(int argc, char **argv)
 
 		argv = new_argv;
 	}
-#endif							/* PS_USE_CLOBBER_ARGV */
+#endif							/* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */
 
 	return argv;
 }
@@ -305,7 +313,18 @@ init_ps_display(const char *fixed_part)
 	/* If ps_buffer is a pointer, it might still be null */
 	if (!ps_buffer)
 		return;
+#endif
 
+	/*
+	 * Overwrite argv[] to point at appropriate space, if applicable
+	 */
+
+#ifdef PS_USE_CHANGE_ARGV
+	save_argv[0] = ps_buffer;
+	save_argv[1] = NULL;
+#endif							/* PS_USE_CHANGE_ARGV */
+
+#ifdef PS_USE_CLOBBER_ARGV
 	/* make extra argv slots point at end_of_area (a NUL) */
 	for (int i = 1; i < save_argc; i++)
 		save_argv[i] = ps_buffer + ps_buffer_size;
-- 
2.51.2

From abe396d8298a515a1e5b68a3f574dcba424714af Mon Sep 17 00:00:00 2001
From: Tom Lane <[email protected]>
Date: Thu, 12 Mar 2026 14:37:27 -0400
Subject: [PATCH v20260312c 2/3] Switch the semaphore API on Solaris to unnamed
 POSIX

Solaris descendants (Illumos, OpenIndiana, OmniOS, etc.) hit System V
semaphore limits ("No space left on device" from semget) when running
many parallel test scripts.  Unnamed POSIX semaphores have been
available on Solaris for decades and work well, so prefer them, as was
recently done for AIX.

The documentation is also updated to remove the now-unnecessary advice
about raising project.max-sem-ids and project.max-msg-ids.

Discussion: https://postgr.es/m/[email protected]
---
 doc/src/sgml/runtime.sgml | 9 ++-------
 meson.build               | 1 +
 src/template/solaris      | 5 +++++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index b1937cd13ab..422a3544f94 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1128,13 +1128,8 @@ projadd -c "PostgreSQL DB User" -K "project.max-shm-memory=(privileged,8GB,deny)
        </para>
 
        <para>
-        Other recommended kernel setting changes for database servers which will
-        have a large number of connections are:
-<programlisting>
-project.max-shm-ids=(priv,32768,deny)
-project.max-sem-ids=(priv,4096,deny)
-project.max-msg-ids=(priv,4096,deny)
-</programlisting>
+        To run a very large server, or multiple servers concurrently, you
+        might also need to raise <literal>project.max-shm-ids</literal>.
        </para>
 
        <para>
diff --git a/meson.build b/meson.build
index 2df54409ca6..b7e337dc132 100644
--- a/meson.build
+++ b/meson.build
@@ -324,6 +324,7 @@ elif host_system == 'openbsd'
 
 elif host_system == 'sunos'
   portname = 'solaris'
+  sema_kind = 'unnamed_posix'
   export_fmt = '-Wl,-M@0@'
   # We need these #defines to get POSIX-conforming versions
   # of many interfaces (sigwait, getpwuid_r, shmdt, ...).
diff --git a/src/template/solaris b/src/template/solaris
index a4d8d38a8f8..ea524fdb2bd 100644
--- a/src/template/solaris
+++ b/src/template/solaris
@@ -1,4 +1,9 @@
 # src/template/solaris
 
+# Prefer unnamed POSIX semaphores if available, unless user overrides choice
+if test x"$PREFERRED_SEMAPHORES" = x"" ; then
+  PREFERRED_SEMAPHORES=UNNAMED_POSIX
+fi
+
 # Extra CFLAGS for code that will go into a shared library
 CFLAGS_SL="-fPIC"
-- 
2.51.2

From cb33c8d547f2e7ecf64621c5eaf8dbab45981b84 Mon Sep 17 00:00:00 2001
From: Greg Burd <[email protected]>
Date: Thu, 12 Mar 2026 14:51:05 -0400
Subject: [PATCH v20260312c 3/3] Make aclitemout work during bootstrap mode

During bootstrap, aclitemout is called (via array_out) when
InsertOneValue emits DEBUG4-level output for aclitem[] columns. The
function tries to resolve role OIDs to names via SearchSysCache1, which
is not available during bootstrap, causing a crash.

Fix by skipping the syscache lookup when IsBootstrapProcessingMode() is
true, falling through to the existing numeric-OID fallback path. This
mirrors how aclitemin was previously hot-wired for bootstrap.

Reported-by: Greg Burd <[email protected]>
Discussion: https://postgr.es/m/[email protected]
---
 src/backend/utils/adt/acl.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 071e3f2c49e..dfb23ea01b5 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -674,7 +674,12 @@ aclitemout(PG_FUNCTION_ARGS)
 
 	if (aip->ai_grantee != ACL_ID_PUBLIC)
 	{
-		htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantee));
+		/*
+		 * During bootstrap the syscache is not yet available, so fall
+		 * through to the numeric-OID output path.
+		 */
+		htup = IsBootstrapProcessingMode() ? NULL :
+			SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantee));
 		if (HeapTupleIsValid(htup))
 		{
 			putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
@@ -702,7 +707,10 @@ aclitemout(PG_FUNCTION_ARGS)
 	*p++ = '/';
 	*p = '\0';
 
-	htup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantor));
+	/* Same bootstrap-mode guard for the grantor lookup */
+	htup = IsBootstrapProcessingMode() ? NULL :
+		SearchSysCache1(AUTHOID, ObjectIdGetDatum(aip->ai_grantor));
+
 	if (HeapTupleIsValid(htup))
 	{
 		putid(p, NameStr(((Form_pg_authid) GETSTRUCT(htup))->rolname));
-- 
2.51.2

Reply via email to