Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUCbx-0006Os-Ix for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Apr 2020 17:04:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jUCbv-00060l-Qw for pgsql-bugs@arkaria.postgresql.org; Thu, 30 Apr 2020 17:04:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUCbv-00060e-L3 for pgsql-bugs@lists.postgresql.org; Thu, 30 Apr 2020 17:04:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUCbr-0001Th-UH for pgsql-bugs@lists.postgresql.org; Thu, 30 Apr 2020 17:04:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 03UH4Pfl006967; Thu, 30 Apr 2020 13:04:25 -0400 From: Tom Lane To: jacobcrell@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16405: Exception P0004 not caught in EXCEPTION WHEN OTHERS In-reply-to: <16405-b2ea8017cd288002@postgresql.org> References: <16405-b2ea8017cd288002@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 30 Apr 2020 16:07:35 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6965.1588266265.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 30 Apr 2020 13:04:25 -0400 Message-ID: <6966.1588266265@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > Excepted Behavior: P0004 exception is caught in EXCEPTION WHEN OTHERS, > function returns text 'Hit the Other exception block'. > Actual Behavior: P0004 exception is raised and remains uncaught. That's intentional, per the documentation [1]: The special condition name OTHERS matches every error type except QUERY_CANCELED and ASSERT_FAILURE. (It is possible, but often unwise, to trap those two error types by name.) regards, tom lane [1] https://www.postgresql.org/docs/current/plpgsql-control-structures.htm= l#PLPGSQL-ERROR-TRAPPING