Re: WHEN SQLSTATE '00000' THEN equals to WHEN OTHERS THEN - Mailing list pgsql-docs

From Tom Lane
Subject Re: WHEN SQLSTATE '00000' THEN equals to WHEN OTHERS THEN
Date
Msg-id 706649.1742398190@sss.pgh.pa.us
Whole thread Raw
In response to WHEN SQLSTATE '00000' THEN equals to WHEN OTHERS THEN  (David Fiedler <david.fido.fiedler@gmail.com>)
List pgsql-docs
David Fiedler <david.fido.fiedler@gmail.com> writes:
> I've stumbled across a code that used this condition, resulting in
> unexpected behavior. I think it worths a note that catching 00000 is not
> possible and that it results in a catch all handler.

Hmph.  The code thinks

     * OTHERS is represented as code 0 (which would map to '00000', but we
     * have no need to represent that as an exception condition).

but it evidently didn't consider the possibility of a user writing
'00000'.  I'm more inclined to consider this a bug and change plpgsql
to use something else internally to represent OTHERS.  We could use
-1, which AFAICS cannot be generated by MAKE_SQLSTATE.

            regards, tom lane



pgsql-docs by date:

Previous
From: David Fiedler
Date:
Subject: WHEN SQLSTATE '00000' THEN equals to WHEN OTHERS THEN
Next
From: Laurenz Albe
Date:
Subject: Re: WHEN SQLSTATE '00000' THEN equals to WHEN OTHERS THEN