|
66 | 66 | staticHeapTupleGetDatabaseTuple(constchar*dbname);
|
67 | 67 | staticHeapTupleGetDatabaseTupleByOid(Oiddboid);
|
68 | 68 | staticvoidPerformAuthentication(Port*port);
|
69 |
| -staticvoidCheckMyDatabase(constchar*name,boolam_superuser); |
| 69 | +staticvoidCheckMyDatabase(constchar*name,boolam_superuser,booloverride_allow_connections); |
70 | 70 | staticvoidInitCommunication(void);
|
71 | 71 | staticvoidShutdownPostgres(intcode,Datumarg);
|
72 | 72 | staticvoidStatementTimeoutHandler(void);
|
@@ -290,7 +290,7 @@ PerformAuthentication(Port *port)
|
290 | 290 | * CheckMyDatabase -- fetch information from the pg_database entry for our DB
|
291 | 291 | */
|
292 | 292 | staticvoid
|
293 |
| -CheckMyDatabase(constchar*name,boolam_superuser) |
| 293 | +CheckMyDatabase(constchar*name,boolam_superuser,booloverride_allow_connections) |
294 | 294 | {
|
295 | 295 | HeapTupletup;
|
296 | 296 | Form_pg_databasedbform;
|
@@ -326,7 +326,7 @@ CheckMyDatabase(const char *name, bool am_superuser)
|
326 | 326 | /*
|
327 | 327 | * Check that the database is currently allowing connections.
|
328 | 328 | */
|
329 |
| -if (!dbform->datallowconn) |
| 329 | +if (!dbform->datallowconn&& !override_allow_connections) |
330 | 330 | ereport(FATAL,
|
331 | 331 | (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
332 | 332 | errmsg("database \"%s\" is not currently accepting connections",
|
@@ -563,7 +563,7 @@ BaseInit(void)
|
563 | 563 | */
|
564 | 564 | void
|
565 | 565 | InitPostgres(constchar*in_dbname,Oiddboid,constchar*username,
|
566 |
| -Oiduseroid,char*out_dbname) |
| 566 | +Oiduseroid,char*out_dbname,booloverride_allow_connections) |
567 | 567 | {
|
568 | 568 | boolbootstrap=IsBootstrapProcessingMode();
|
569 | 569 | boolam_superuser;
|
@@ -1006,7 +1006,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
|
1006 | 1006 | * user is a superuser, so the above stuff has to happen first.)
|
1007 | 1007 | */
|
1008 | 1008 | if (!bootstrap)
|
1009 |
| -CheckMyDatabase(dbname,am_superuser); |
| 1009 | +CheckMyDatabase(dbname,am_superuser,override_allow_connections); |
1010 | 1010 |
|
1011 | 1011 | /*
|
1012 | 1012 | * Now process any command-line switches and any additional GUC variable
|
|