On Wed, Sep 11, 2024 at 03:37:17PM +0900, Michael Paquier wrote:
> 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.

Do we want to apply this patch?  I added a comma to the text, attached.

-- 
  Bruce Momjian  <br...@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  When a patient asks the doctor, "Am I going to die?", he means 
  "Am I going to die soon?"
iff --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
     <replaceable>statements</replaceable>
 EXCEPTION
     WHEN <replaceable>condition</replaceable> <optional> OR <replaceable>condition</replaceable> ... </optional> THEN
-        <replaceable>handler_statements</replaceable>
+        <optional> <replaceable>handler_statements</replaceable> </optional>
     <optional> WHEN <replaceable>condition</replaceable> <optional> OR <replaceable>condition</replaceable> ... </optional> THEN
-          <replaceable>handler_statements</replaceable>
+          <optional> <replaceable>handler_statements</replaceable> </optional>
       ... </optional>
 END;
 </synopsis>
@@ -2821,8 +2821,8 @@ END;
      abandoned, and control passes to the <literal>EXCEPTION</literal> list.
      The list is searched for the first <replaceable>condition</replaceable>
      matching the error that occurred.  If a match is found, the
-     corresponding <replaceable>handler_statements</replaceable> are
-     executed, and then control passes to the next statement after
+     corresponding <replaceable>handler_statements</replaceable>, if
+     specified, are executed, and then control passes to the next statement after
      <literal>END</literal>.  If no match is found, the error propagates out
      as though the <literal>EXCEPTION</literal> clause were not there at all:
      the error can be caught by an enclosing block with

Reply via email to