Re: Error code for "terminating connection due to conflict with recovery"
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Kevin Grittner <Kevin.Grittner@wicourts.gov>, Bruce Momjian <bruce@momjian.us>, fgp@phlo.org, Tatsuo Ishii <ishii@postgresql.org>, pgsql-hackers@postgresql.org
Date: 2011-01-31T19:58:27Z
Lists: pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes: > On Mon, 2011-01-31 at 11:24 -0500, Robert Haas wrote: >> , or to use a new >> error code. ERRCODE_ADMIN_SHUTDOWN is just strange. > It's not strange at all. It's the same error code as we use for all of > the other cases listed. We need that because it is the current > catch-all errcode for "cannot retry". > The purpose of errcodes is to allow programs to check them and then act. > It's pointless to add a new errcode that is so rare that nobody will > ever program for it because they won't expect it, let alone test for it. > Or at least won't assign any sensible priority to handling that error. The trouble with ERRCODE_ADMIN_SHUTDOWN is that it might lead a connection pooler to expect that *all* its connections are going bad, not just the ones that are connected to a specific database. I think this is a bad decision. Programs that are interested in testing for this case at all are likely to need to be worried about that distinction. Also, while I believe that ERRCODE_T_R_DEADLOCK_DETECTED is a reasonable catchall retry code, I don't think it's equally sane to think that ERRCODE_ADMIN_SHUTDOWN is a catchall non-retry code. regards, tom lane