]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix SHOW ALL command for non-superusers with replication connection
authorMichael Paquier <michael@paquier.xyz>
Mon, 15 Apr 2019 03:34:51 +0000 (12:34 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 15 Apr 2019 03:34:51 +0000 (12:34 +0900)
commit51290264346f0afce9752e5f6c957e1bfa3d2391
tree186f8bdf5a3586356ebbaa299d53a8a2fd85a85b
parent0bdf6d635e42f415c023393503a575d047940722
Fix SHOW ALL command for non-superusers with replication connection

Since Postgres 10, SHOW commands can be triggered with replication
connections in a WAL sender context, however it missed that a
transaction context is needed for syscache lookups.  This commit makes
sure that the syscache lookups can happen correctly by setting a
transaction context when running SHOW commands in a WAL sender.

Superuser-only parameters can be displayed using SHOW commands not only
to superusers, but also to members of system role pg_read_all_settings,
which requires a syscache lookup to check if the connected role is a
member of this system role or not, or the instance crashes.  Superusers
do not need to check the syscache so it worked correctly in this case.

New tests are added to cover this issue.

Reported-by: Alexander Kukushkin
Author: Michael Paquier
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/15734-2daa8761eeed8e20@postgresql.org
Backpatch-through: 10
src/backend/replication/walsender.c
src/test/perl/PostgresNode.pm
src/test/recovery/t/001_stream_rep.pl