diff options
author | Robert Haas <rhaas@postgresql.org> | 2015-10-16 11:37:19 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2015-10-16 11:40:03 -0400 |
commit | 73d71cde5751e06d372431178e740835284eb132 (patch) | |
tree | c4fd624ce4f26126ed60dfec29b7a0c353947f8f /src/backend/access/transam/parallel.c | |
parent | 14129d1c9e2d3afa064651012a55c9c84aa6821a (diff) | |
download | postgresql-73d71cde5751e06d372431178e740835284eb132.tar.gz postgresql-73d71cde5751e06d372431178e740835284eb132.zip |
Fix a problem with parallel workers being unable to restore role.
check_role() tries to verify that the user has permission to become the
requested role, but this is inappropriate in a parallel worker, which
needs to exactly recreate the master's authorization settings. So skip
the check in that case.
This fixes a bug in commit 924bcf4f16d54c55310b28f77686608684734f42.
Diffstat (limited to 'src/backend/access/transam/parallel.c')
-rw-r--r-- | src/backend/access/transam/parallel.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c index e09bdb20b0d..9c7428f5d6c 100644 --- a/src/backend/access/transam/parallel.c +++ b/src/backend/access/transam/parallel.c @@ -96,6 +96,9 @@ int ParallelWorkerNumber = -1; /* Is there a parallel message pending which we need to receive? */ bool ParallelMessagePending = false; +/* Are we initializing a parallel worker? */ +bool InitializingParallelWorker = false; + /* Pointer to our fixed parallel state. */ static FixedParallelState *MyFixedParallelState; @@ -815,6 +818,9 @@ ParallelWorkerMain(Datum main_arg) char *tstatespace; StringInfoData msgbuf; + /* Set flag to indicate that we're initializing a parallel worker. */ + InitializingParallelWorker = true; + /* Establish signal handlers. */ pqsignal(SIGTERM, die); BackgroundWorkerUnblockSignals(); @@ -942,6 +948,7 @@ ParallelWorkerMain(Datum main_arg) * We've initialized all of our state now; nothing should change * hereafter. */ + InitializingParallelWorker = false; EnterParallelMode(); /* |