| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | David Fiedler <david(dot)fido(dot)fiedler(at)gmail(dot)com> |
| Cc: | pgsql-docs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: WHEN SQLSTATE '00000' THEN equals to WHEN OTHERS THEN |
| Date: | 2025-03-19 15:29:50 |
| Message-ID: | 706649.1742398190@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-docs pgsql-hackers |
David Fiedler <david(dot)fido(dot)fiedler(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2025-03-19 15:32:20 | Re: WHEN SQLSTATE '00000' THEN equals to WHEN OTHERS THEN |
| Previous Message | David Fiedler | 2025-03-19 14:03:34 | WHEN SQLSTATE '00000' THEN equals to WHEN OTHERS THEN |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2025-03-19 15:31:22 | Re: optimize file transfer in pg_upgrade |
| Previous Message | Nathan Bossart | 2025-03-19 15:01:26 | Re: PATCH: warn about, and deprecate, clear text passwords |