Prevent show_session_authorization from crashing when session_authorization
authorTom Lane <[email protected]>
Thu, 23 Sep 2010 20:53:33 +0000 (16:53 -0400)
committerTom Lane <[email protected]>
Thu, 23 Sep 2010 20:53:33 +0000 (16:53 -0400)
commit7548ecb37380393fe6457fb405cdc86dd34a3390
tree39ed4f1ae56d59729024c07432d08ba79c1ee915
parent9e20bdf9a8417615f40ddf3c8e6e34be2e7e88e2
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.
src/backend/commands/variable.c