@@ -205,14 +205,24 @@ char *ListenAddresses;
205205
206206/*
207207 * SuperuserReservedConnections is the number of backends reserved for
208- * superuser use. This number is taken out of the pool size given by
209- * MaxConnections so number of backend slots available to non-superusers is
210- * (MaxConnections - SuperuserReservedConnections). Note what this really
211- * means is "if there are <= SuperuserReservedConnections connections
212- * available, only superusers can make new connections" --- pre-existing
213- * superuser connections don't count against the limit.
208+ * superuser use, and ReservedConnections is the number of backends reserved
209+ * for use by roles with privileges of the pg_use_reserved_connections
210+ * predefined role. These are taken out of the pool of MaxConnections backend
211+ * slots, so the number of backend slots available for roles that are neither
212+ * superuser nor have privileges of pg_use_reserved_connections is
213+ * (MaxConnections - SuperuserReservedConnections - ReservedConnections).
214+ *
215+ * If the number of remaining slots is less than or equal to
216+ * SuperuserReservedConnections, only superusers can make new connections. If
217+ * the number of remaining slots is greater than SuperuserReservedConnections
218+ * but less than or equal to
219+ * (SuperuserReservedConnections + ReservedConnections), only superusers and
220+ * roles with privileges of pg_use_reserved_connections can make new
221+ * connections. Note that pre-existing superuser and
222+ * pg_use_reserved_connections connections don't count against the limits.
214223 */
215224int SuperuserReservedConnections ;
225+ int ReservedConnections ;
216226
217227/* The socket(s) we're listening to. */
218228#define MAXLISTEN 64
@@ -908,11 +918,12 @@ PostmasterMain(int argc, char *argv[])
908918 /*
909919 * Check for invalid combinations of GUC settings.
910920 */
911- if (SuperuserReservedConnections >= MaxConnections )
921+ if (SuperuserReservedConnections + ReservedConnections >= MaxConnections )
912922 {
913- write_stderr ("%s: superuser_reserved_connections (%d) must be less than max_connections (%d)\n" ,
923+ write_stderr ("%s: superuser_reserved_connections (%d) plus reserved_connections (%d) must be less than max_connections (%d)\n" ,
914924 progname ,
915- SuperuserReservedConnections , MaxConnections );
925+ SuperuserReservedConnections , ReservedConnections ,
926+ MaxConnections );
916927 ExitPostmaster (1 );
917928 }
918929 if (XLogArchiveMode > ARCHIVE_MODE_OFF && wal_level == WAL_LEVEL_MINIMAL )
0 commit comments