diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 219ceba7ce54124b703d38fc848a3ff5b502ccc5..bbeb50f332a67f7274041ccb4a065da47f9f4d3b 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -771,6 +771,10 @@ show_session_authorization(void)
 	Oid			savedoid;
 	char	   *endptr;
 
+	/* If session_authorization hasn't been set in this process, return "" */
+	if (value == NULL || value[0] == '\0')
+		return "";
+
 	Assert(strspn(value, "x") == NAMEDATALEN &&
 		   (value[NAMEDATALEN] == 'T' || value[NAMEDATALEN] == 'F'));