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 1o0ptt-0003bU-Bt for pgsql-general@arkaria.postgresql.org; Mon, 13 Jun 2022 19:39:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o0ptr-0002RR-UX for pgsql-general@arkaria.postgresql.org; Mon, 13 Jun 2022 19:38:59 +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 1o0ptr-0002RI-KD for pgsql-general@lists.postgresql.org; Mon, 13 Jun 2022 19:38:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o0pto-0004Zb-S4 for pgsql-general@lists.postgresql.org; Mon, 13 Jun 2022 19:38:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 25DJcsc63910373; Mon, 13 Jun 2022 15:38:54 -0400 From: Tom Lane To: Bryn Llewellyn cc: Pavel Stehule , pgsql-general list , "David G. Johnston" Subject: Re: "A block containing an EXCEPTION clause is significantly more expensive to enter and exit than a block without one" In-reply-to: References: <24CD0FA6-F58C-44B5-B3D5-FE704A63E5CA@yugabyte.com> Comments: In-reply-to Bryn Llewellyn message dated "Mon, 13 Jun 2022 12:01:55 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3910371.1655149134.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 13 Jun 2022 15:38:54 -0400 Message-ID: <3910372.1655149134@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bryn Llewellyn writes: > OK, so I'm obliged to answer. > Because SQL rests on the principle that you just say *what* you want but > not *how*. It also rests on the principle that the programmer shouldn't be too concerned about micro-efficiencies. You've given a perfectly good six-line implementation of what you want; use it and be happy. > Oracle Database 12c Release 2 (and later) has a validate_conversion() bu= ilt-in. [ shrug... ] We are not Oracle. One of the main ways in which we are not Oracle is that we support extensible database functionality. To write a "validate_conversion" function that supports extension datatypes, but doesn't use something morally equivalent to a subtransaction, would be a nightmare: large, fragile, and probably not all that much faster. regards, tom lane