Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1soGyo-009ojS-Tg for pgsql-docs@arkaria.postgresql.org; Wed, 11 Sep 2024 06:37:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1soGyo-00A7cj-Aq for pgsql-docs@arkaria.postgresql.org; Wed, 11 Sep 2024 06:37:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1soGyn-00A7Zy-Vl for pgsql-docs@lists.postgresql.org; Wed, 11 Sep 2024 06:37:30 +0000 Received: from fout8-smtp.messagingengine.com ([103.168.172.151]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1soGyl-000aQV-6m for pgsql-docs@lists.postgresql.org; Wed, 11 Sep 2024 06:37:28 +0000 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 3893C13803B8; Wed, 11 Sep 2024 02:37:26 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 11 Sep 2024 02:37:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1726036646; x=1726123046; bh=FAYx09Y0q5 iZz91q0YMHbxjU17WPx1QSZWzy0zo2PPA=; b=gSei114m2J25id98ZPNu1NwlBQ iAn+STQUOvZYKLghUNpAhQPN5HDwLb/lDOrzR7TRAmpL7YMs+18EVzVxneVKifFZ NnoqPGPkAnMHfwivRLzXGM6veHzFNUKNhQxvz1/KbatVnmivne5BgiwMmeOwR81b L8aEshjm1LA+zH0CrYMhL9dMcEbi8rqyqRHy2Y1S8nSsoeEhzPh17AaudUhJFoF+ 92Sej+Oi7bZKn/P3z2Cm9q4bGmjgGnJTSMYkS2UeAUXD6q/lwjcoO9H2K3YNYNrW Mv1q83PjWwBNyFGY+Nc9jdto1Ixrfne/sXl06yV0z8rIbRV+A1oubjFQJzvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1726036646; x=1726123046; bh=FAYx09Y0q5iZz91q0YMHbxjU17WP x1QSZWzy0zo2PPA=; b=PNy1dcJ5beJoRZzxizI1emBtYdzDSqdfy99hg8g8zcEq XJDihVMMmQ/y4Ac9tZz+/iNVZGl6juu8Hu9vCBZ+wndcC773oZ/w8rKciH66kIRS xijez/ZsqdTw+0f2YmMB4DrW9c3rCynv/xcyDS4C7OkBMcDWDVp05NOEuWhFwr6+ qvA9A+DNASMY04LISuCYNM93Ucyf07pduI4WrrYmjkZmBO6wh2c2HOGCN9wegDhI 5cVm3SmQFAO2NuN7CpQ6c7J2HljDtNGgh+xvub5YGdCJoHSVQVtnnKkyegiZf80B N2WpJh3E7vA2HzXLqJaOHGs6HtWuWNpBA8yoGidQJA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudejtddguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffk fhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrh cuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeet leeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghl sehprghquhhivghrrdighiiipdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehphhhilhhiphhprdhsrghlvhhishgsvghrghesghhmrghilhdr tghomhdprhgtphhtthhopehpghhsqhhlqdguohgtsheslhhishhtshdrphhoshhtghhrvg hsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Sep 2024 02:37:24 -0400 (EDT) Date: Wed, 11 Sep 2024 15:37:17 +0900 From: Michael Paquier To: Philipp Salvisberg Cc: pgsql-docs@lists.postgresql.org Subject: Re: Undocumented optionality of handler_statements Message-ID: References: <172165655256.710.2097726158572647813@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tDCxDAb1Q78I9qDG" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --tDCxDAb1Q78I9qDG Content-Type: multipart/mixed; boundary="Za4dOZB3PZqN3QEg" Content-Disposition: inline --Za4dOZB3PZqN3QEg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 23, 2024 at 01:25:39PM +0200, Philipp Salvisberg wrote: > read "optional" as "mandatory". They're optional, like in empty being optional. If not specified, the block goes to its END. > Therefore, I suggest to change this example by adding a NULL > statement as in other examples. This change would make the > documentation consistent and handle the optionality of > handler_statements as an implementation detail. I created a patch > for plpgsql.sgml based on the master branch, adding a NULL statement > in empty exception handlers (see attached file > doc_patch_using_null_stmt_instead_of_empty_exception_handler_v1.diff). These examples have been around for 20 years with, and I think that it is helpful to show this pattern as well. So if I were to do something about that, I would suggest the attached. -- Michael --Za4dOZB3PZqN3QEg Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="doc-plpgsql-error.patch" diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 78e4983139..3a5e7bc296 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -2804,9 +2804,9 @@ BEGIN statements EXCEPTION WHEN condition OR condition ... THEN - handler_statements + handler_statements WHEN condition OR condition ... THEN - handler_statements + handler_statements ... END; @@ -2821,8 +2821,8 @@ END; abandoned, and control passes to the EXCEPTION list. The list is searched for the first condition matching the error that occurred. If a match is found, the - corresponding handler_statements are - executed, and then control passes to the next statement after + corresponding handler_statements, if + specified are executed, and then control passes to the next statement after END. If no match is found, the error propagates out as though the EXCEPTION clause were not there at all: the error can be caught by an enclosing block with --Za4dOZB3PZqN3QEg-- --tDCxDAb1Q78I9qDG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmbhOp0ACgkQnvQgOdby QH1SEhAAmYzNnz2wSqllIxc1fCxRasljpHxNvsogBEsr1IFG4Rtdjg2C8BFTkbOu 4UqqcSSl5QF07jBiXPYsNA+w8El5isxYj1mXL9xwIDkTzt+3UrRYwZ6kkstZc9Qe QmDXqF/Flyyv0DVwKNaajXNLy/cImmjMeyGe1OEoB2GUo5SSU4QqKvS/u04iHHED V3yHSCRQ1AhS1MOSgv264vhY83bjsxnPPzU/LDGKH03frHg6/u0+B7CYlR/s6oRi 140lJBmwbQ1OyxNPREfdTfZeX+Di9MS8tBDkE6Z+6tsfn+BQEEiFkGfCz7dSd6HN 1hiupNTl80Y6OcVnx1bMjyip+usZgs25MFZVYR3j28wYgknN5EpZ3UiMDOXMVeo/ 6NwJni2brhBQBRz/oVp4YwNo5E69lgFMrjtD44W4G+WpgZtHPE1i6kibLQLGXfIU H0ZUWrhd6locYv12TAHsMJhaYGd7wrEZJBPXIDLs3HJyXzbJXfnv5O91SXEbp7XT rWe5K56Fks3r/14Gml0XmAFsKNe7x9+EFXlNdLRarn2OQu7d1Qi6qeIBcrsct3H8 3zlhSW1fqVCTgPQ9MEnQIbwVuvL+1ucflCGwyXoGGcG7267yIxVoYSqjzbH/HhWN 67NtIeZa9TEJMafptIKrkwEqvpiV0wDV1ikxB+8QgNFybRBgq9g= =x5Hy -----END PGP SIGNATURE----- --tDCxDAb1Q78I9qDG--