Skip to content

Commit 511449d

Browse files
committed
Prevent show_session_authorization from crashing when session_authorization
hasn't been set. The only known case where this can happen is when show_session_authorization is invoked in an autovacuum process, which is possible if an index function calls it, as for example in bug #5669 from Andrew Geery. We could perhaps try to return a sensible value, such as the name of the cluster-owning superuser; but that seems like much more trouble than the case is worth, and in any case it could create new possible failure modes. Simply returning an empty string seems like the most appropriate fix. Back-patch to all supported versions, even those before autovacuum, just in case there's another way to provoke this crash.
1 parent 4e2e9f2 commit 511449d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/commands/variable.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,10 @@ show_session_authorization(void)
680680
Oid savedoid;
681681
char *endptr;
682682

683+
/* If session_authorization hasn't been set in this process, return "" */
684+
if (value == NULL || value[0] == '\0')
685+
return "";
686+
683687
Assert(strspn(value, "x") == NAMEDATALEN &&
684688
(value[NAMEDATALEN] == 'T' || value[NAMEDATALEN] == 'F'));
685689

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy