Fix per-session activation of ALTER {ROLE|DATABASE} SET role.
authorNoah Misch <noah@leadboat.com>
Sat, 16 Nov 2024 04:39:56 +0000 (20:39 -0800)
committerNoah Misch <noah@leadboat.com>
Sat, 16 Nov 2024 04:40:00 +0000 (20:40 -0800)
commitc463338656ac47e5210fcf9fbf7d20efccce8de8
tree1ccb7018523f7ce7227c45b80613d268fb636fed
parent20a82026828536331ebe912b86f060078a173633
Fix per-session activation of ALTER {ROLE|DATABASE} SET role.

After commit 5a2fed911a85ed6d8a015a6bafe3a0d9a69334ae, the catalog state
resulting from these commands ceased to affect sessions.  Restore the
longstanding behavior, which is like beginning the session with a SET
ROLE command.  If cherry-picking the CVE-2024-10978 fixes, default to
including this, too.  (This fixes an unintended side effect of fixing
CVE-2024-10978.)  Back-patch to v12, like that commit.  The release team
decided to include v12, despite the original intent to halt v12 commits
earlier this week.

Tom Lane and Noah Misch.  Reported by Etienne LAFARGE.

Discussion: http://postgr.es/m/CADOZwSb0UsEr4_UTFXC5k7=fyyK8uKXekucd+-uuGjJsGBfxgw@mail.gmail.com
src/backend/utils/init/miscinit.c
src/backend/utils/misc/guc.c
src/test/modules/unsafe_tests/Makefile
src/test/modules/unsafe_tests/expected/setconfig.out [new file with mode: 0644]
src/test/modules/unsafe_tests/sql/setconfig.sql [new file with mode: 0644]