Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita3c6d10

Browse files
committed
Move the check for whether walreceiver has authenticated as a superuser
from walsender.c, where it didn't really belong, to postinit.c where it doesbelong (and is essentially free, too).
1 parentea46000 commita3c6d10

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

‎src/backend/replication/walsender.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
*
3232
* IDENTIFICATION
33-
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.16 2010/04/12 10:18:50 heikki Exp $
33+
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.17 2010/04/21 00:51:56 tgl Exp $
3434
*
3535
*-------------------------------------------------------------------------
3636
*/
@@ -47,13 +47,13 @@
4747
#include"replication/walsender.h"
4848
#include"storage/fd.h"
4949
#include"storage/ipc.h"
50-
#include"storage/lock.h"
5150
#include"storage/pmsignal.h"
5251
#include"tcop/tcopprot.h"
5352
#include"utils/guc.h"
5453
#include"utils/memutils.h"
5554
#include"utils/ps_status.h"
5655

56+
5757
/* Array of WalSnds in shared memory */
5858
WalSndCtlData*WalSndCtl=NULL;
5959

@@ -114,11 +114,6 @@ WalSenderMain(void)
114114
{
115115
MemoryContextwalsnd_context;
116116

117-
if (!superuser())
118-
ereport(FATAL,
119-
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
120-
errmsg("must be superuser to start walsender")));
121-
122117
if (RecoveryInProgress())
123118
ereport(FATAL,
124119
(errcode(ERRCODE_CANNOT_CONNECT_NOW),

‎src/backend/utils/init/postinit.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.210 2010/04/20 23:48:47 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.211 2010/04/21 00:51:57 tgl Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -624,6 +624,11 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
624624
if (am_walsender)
625625
{
626626
Assert(!bootstrap);
627+
/* must have authenticated as a superuser */
628+
if (!am_superuser)
629+
ereport(FATAL,
630+
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
631+
errmsg("must be superuser to start walsender")));
627632
/* report this backend in the PgBackendStatus array */
628633
pgstat_bestart();
629634
/* close the transaction we started above */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp