Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e7e7da2

Browse files
committed
Fix possible logical replication crash.
Commit c3afe8c added a new password_required option but forgot that you need database access to check whether an arbitrary role ID is a superuser. Report and patch by Hou Zhijie. I added a comment. Thanks to Alexander Lakhin for devising a way to reproduce the crash. Discussion: http://postgr.es/m/OS0PR01MB5716BFD7EC44284C89F40808948F9@OS0PR01MB5716.jpnprd01.prod.outlook.com
1 parent a8a0012 commit e7e7da2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/replication/logical/worker.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4545,12 +4545,14 @@ ApplyWorkerMain(Datum main_arg)
45454545
replorigin_session_setup(originid, 0);
45464546
replorigin_session_origin = originid;
45474547
origin_startpos = replorigin_session_get_progress(false);
4548-
CommitTransactionCommand();
45494548

45504549
/* Is the use of a password mandatory? */
45514550
must_use_password = MySubscription->passwordrequired &&
45524551
!superuser_arg(MySubscription->owner);
45534552

4553+
/* Note that the superuser_arg call can access the DB */
4554+
CommitTransactionCommand();
4555+
45544556
LogRepWorkerWalRcvConn = walrcv_connect(MySubscription->conninfo, true,
45554557
must_use_password,
45564558
MySubscription->name, &err);

0 commit comments

Comments
 (0)