Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9e95c9a

Browse files
Create new errcode for recovery conflict caused by db drop on master.
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
1 parent 44df84d commit 9e95c9a

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

doc/src/sgml/errcodes.sgml

+5
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,11 @@
985985
<entry>deadlock_detected</entry>
986986
</row>
987987

988+
<row>
989+
<entry><literal>40P02</literal></entry>
990+
<entry>DATABASE DROPPED</entry>
991+
<entry>database_dropped</entry>
992+
</row>
988993

989994
<row>
990995
<entry spanname="span13"><emphasis role="bold">Class 42 &mdash; Syntax Error or Access Rule Violation</></entry>

src/backend/tcop/postgres.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -2912,9 +2912,11 @@ ProcessInterrupts(void)
29122912
}
29132913
else if (RecoveryConflictPending)
29142914
{
2915+
/* Currently there is only one non-retryable recovery conflict */
2916+
Assert(RecoveryConflictReason == PROCSIG_RECOVERY_CONFLICT_DATABASE);
29152917
pgstat_report_recovery_conflict(RecoveryConflictReason);
29162918
ereport(FATAL,
2917-
(errcode(ERRCODE_ADMIN_SHUTDOWN),
2919+
(errcode(ERRCODE_T_R_DATABASE_DROPPED),
29182920
errmsg("terminating connection due to conflict with recovery"),
29192921
errdetail_recovery_conflict()));
29202922
}

src/include/utils/errcodes.h

+1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@
243243
#define ERRCODE_T_R_SERIALIZATION_FAILURE MAKE_SQLSTATE('4','0', '0','0','1')
244244
#define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN MAKE_SQLSTATE('4','0', '0','0','3')
245245
#define ERRCODE_T_R_DEADLOCK_DETECTED MAKE_SQLSTATE('4','0', 'P','0','1')
246+
#define ERRCODE_T_R_DATABASE_DROPPED MAKE_SQLSTATE('4','0', 'P','0','2')
246247

247248
/* Class 42 - Syntax Error or Access Rule Violation */
248249
#define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION MAKE_SQLSTATE('4','2', '0','0','0')

src/pl/plpgsql/src/plerrcodes.h

+4
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,10 @@
483483
"deadlock_detected", ERRCODE_T_R_DEADLOCK_DETECTED
484484
},
485485

486+
{
487+
"database_dropped", ERRCODE_T_R_DATABASE_DROPPED
488+
},
489+
486490
{
487491
"syntax_error_or_access_rule_violation", ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION
488492
},

0 commit comments

Comments
 (0)