Improve plpgsql's RAISE command. It is now possible to attach DETAIL and
Tom Lane <tgl@sss.pgh.pa.us>
Improve plpgsql's RAISE command. It is now possible to attach DETAIL and HINT fields to a user-thrown error message, and to specify the SQLSTATE error code to use. The syntax has also been tweaked so that the Oracle-compatible case "RAISE exception_name" works (though you won't get a very nice error message if you just write that much). Lastly, support the Oracle-compatible syntax "RAISE" with no parameters to re-throw the current error from within an EXCEPTION block. In passing, allow the syntax SQLSTATE 'nnnnn' within EXCEPTION lists, so that there is a way to trap errors with custom SQLSTATE codes. Pavel Stehule and Tom Lane
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/plpgsql.sgml | modified | +104 −22 |
| src/pl/plpgsql/src/gram.y | modified | +210 −64 |
| src/pl/plpgsql/src/pl_comp.c | modified | +37 −1 |
| src/pl/plpgsql/src/pl_exec.c | modified | +183 −58 |
| src/pl/plpgsql/src/pl_funcs.c | modified | +37 −2 |
| src/pl/plpgsql/src/plpgsql.h | modified | +27 −4 |
| src/pl/plpgsql/src/scan.l | modified | +1 −6 |
| src/test/regress/expected/plpgsql.out | modified | +130 −1 |
| src/test/regress/sql/plpgsql.sql | modified | +130 −1 |