]> granicus.if.org Git - postgresql/commitdiff
Create new errcode for recovery conflict caused by db drop on master.
authorSimon Riggs <simon@2ndQuadrant.com>
Tue, 1 Feb 2011 00:20:53 +0000 (00:20 +0000)
committerSimon Riggs <simon@2ndQuadrant.com>
Tue, 1 Feb 2011 00:20:53 +0000 (00:20 +0000)
Previously reported as ERRCODE_ADMIN_SHUTDOWN, this case is now
reported as ERRCODE_T_R_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, edits by me, review by Robert Haas

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

index 3a1baf58831e9baf24f2e8c5cd828dc895d74ced..d19de947b4cff64439ca4260625ae6f5fe3d3b4d 100644 (file)
 <entry>deadlock_detected</entry>
 </row>
 
+<row>
+<entry><literal>40P02</literal></entry>
+<entry>DATABASE DROPPED</entry>
+<entry>database_dropped</entry>
+</row>
 
 <row>
 <entry spanname="span13"><emphasis role="bold">Class 42 &mdash; Syntax Error or Access Rule Violation</></entry>
index 535926a937ac9cfb66d5935e76c763cc8a3cdc78..f6ccbb952438b16b638b5e65fa2a81d2f8c9ea7c 100644 (file)
@@ -2912,9 +2912,11 @@ ProcessInterrupts(void)
                }
                else if (RecoveryConflictPending)
                {
+                       /* Currently there is only one non-retryable recovery conflict */
+                       Assert(RecoveryConflictReason == PROCSIG_RECOVERY_CONFLICT_DATABASE);
                        pgstat_report_recovery_conflict(RecoveryConflictReason);
                        ereport(FATAL,
-                                       (errcode(ERRCODE_ADMIN_SHUTDOWN),
+                                       (errcode(ERRCODE_T_R_DATABASE_DROPPED),
                          errmsg("terminating connection due to conflict with recovery"),
                                         errdetail_recovery_conflict()));
                }
index 7f2d589f1406c585cdbb64667b6fa7439277eb58..8a9a8d460a5b4676ff3ad89bc06ff78f4887fbf2 100644 (file)
 #define ERRCODE_T_R_SERIALIZATION_FAILURE      MAKE_SQLSTATE('4','0', '0','0','1')
 #define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN       MAKE_SQLSTATE('4','0', '0','0','3')
 #define ERRCODE_T_R_DEADLOCK_DETECTED          MAKE_SQLSTATE('4','0', 'P','0','1')
+#define ERRCODE_T_R_DATABASE_DROPPED           MAKE_SQLSTATE('4','0', 'P','0','2')
 
 /* Class 42 - Syntax Error or Access Rule Violation */
 #define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION          MAKE_SQLSTATE('4','2', '0','0','0')
index 812446ffdf3122abebc0d08a3c047c5d5ca595e2..50f5741379044f9df7e169b5a8ab5f136276f3bc 100644 (file)
        "deadlock_detected", ERRCODE_T_R_DEADLOCK_DETECTED
 },
 
+{
+       "database_dropped", ERRCODE_T_R_DATABASE_DROPPED
+},
+
 {
        "syntax_error_or_access_rule_violation", ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION
 },