Skip to content

Commit b5c5173

Browse files
author
Amit Kapila
committed
Fix possible crash in tablesync worker.
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. Commit e7e7da2 fixed a similar bug in apply worker, and this patch fixes a similar bug in tablesync worker. Author: Hou Zhijie Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/OS0PR01MB571607F5A9D723755268D36294759@OS0PR01MB5716.jpnprd01.prod.outlook.com
1 parent f9f31aa commit b5c5173

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/backend/replication/logical/tablesync.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,12 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
12621262
relstate = GetSubscriptionRelState(MyLogicalRepWorker->subid,
12631263
MyLogicalRepWorker->relid,
12641264
&relstate_lsn);
1265+
1266+
/* Is the use of a password mandatory? */
1267+
must_use_password = MySubscription->passwordrequired &&
1268+
!superuser_arg(MySubscription->owner);
1269+
1270+
/* Note that the superuser_arg call can access the DB */
12651271
CommitTransactionCommand();
12661272

12671273
SpinLockAcquire(&MyLogicalRepWorker->relmutex);
@@ -1288,10 +1294,6 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
12881294
slotname,
12891295
NAMEDATALEN);
12901296

1291-
/* Is the use of a password mandatory? */
1292-
must_use_password = MySubscription->passwordrequired &&
1293-
!superuser_arg(MySubscription->owner);
1294-
12951297
/*
12961298
* Here we use the slot name instead of the subscription name as the
12971299
* application_name, so that it is different from the leader apply worker,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy