aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/init
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/init')
-rw-r--r--src/backend/utils/init/globals.c1
-rw-r--r--src/backend/utils/init/postinit.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 984ffd0c73e..c4c41544a21 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -85,6 +85,7 @@ pid_t PostmasterPid = 0;
*/
bool IsPostmasterEnvironment = false;
bool IsUnderPostmaster = false;
+bool IsBinaryUpgrade = false;
bool ExitOnAnyError = false;
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index a4c5d4c69ab..1f6fba5f752 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -626,6 +626,16 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
}
/*
+ * Binary upgrades only allowed super-user connections
+ */
+ if (IsBinaryUpgrade && !am_superuser)
+ {
+ ereport(FATAL,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ errmsg("must be superuser to connect in binary upgrade mode")));
+ }
+
+ /*
* The last few connections slots are reserved for superusers. Although
* replication connections currently require superuser privileges, we
* don't allow them to consume the reserved slots, which are intended for