OSDN Git Service

Create new errcode for recovery conflict caused by db drop on master.
authorSimon Riggs <simon@2ndQuadrant.com>
Tue, 1 Feb 2011 08:49:58 +0000 (08:49 +0000)
committerSimon Riggs <simon@2ndQuadrant.com>
Tue, 1 Feb 2011 08:49:58 +0000 (08:49 +0000)
Previously reported as ERRCODE_ADMIN_SHUTDOWN, this case is now
reported as ERRCODE_DATABASE_DROPPED. No message text change.
Unlikely to happen on most servers, so low impact change to allow
session poolers to correctly handle this situation.

Tatsuo Ishii and Simon Riggs

doc/src/sgml/errcodes.sgml
src/backend/tcop/postgres.c
src/include/utils/errcodes.h
src/pl/plpgsql/src/plerrcodes.h

index b5962f9..c052670 100644 (file)
 <entry>cannot_connect_now</entry>
 </row>
 
+<row>
+<entry><literal>57P04</literal></entry>
+<entry>DATABASE DROPPED</entry>
+<entry>database_dropped</entry>
+</row>
+
 
 <row>
 <entry spanname="span13"><emphasis role="bold">Class 58 &mdash; System Error (errors external to <productname>PostgreSQL</> itself)</></entry>
index 08369df..3470575 100644 (file)
@@ -2908,7 +2908,7 @@ ProcessInterrupts(void)
                                         errdetail_recovery_conflict()));
                else if (RecoveryConflictPending)
                        ereport(FATAL,
-                                       (errcode(ERRCODE_ADMIN_SHUTDOWN),
+                                       (errcode(ERRCODE_DATABASE_DROPPED),
                          errmsg("terminating connection due to conflict with recovery"),
                                         errdetail_recovery_conflict()));
                else
index f7be261..be13920 100644 (file)
 #define ERRCODE_ADMIN_SHUTDOWN                         MAKE_SQLSTATE('5','7', 'P','0','1')
 #define ERRCODE_CRASH_SHUTDOWN                         MAKE_SQLSTATE('5','7', 'P','0','2')
 #define ERRCODE_CANNOT_CONNECT_NOW                     MAKE_SQLSTATE('5','7', 'P','0','3')
+#define ERRCODE_DATABASE_DROPPED                       MAKE_SQLSTATE('5','7', 'P','0','4')
 
 /* Class 58 - System Error (class borrowed from DB2) */
 /* (we define this as errors external to PostgreSQL itself) */
index 99008be..dcaf006 100644 (file)
 },
 
 {
+       "database_dropped", ERRCODE_DATABASE_DROPPED
+},
+
+{
        "io_error", ERRCODE_IO_ERROR
 },