-
- Downloads
Implement two new special variables in PL/PgSQL: SQLSTATE and SQLERRM.
These contain the SQLSTATE and error message of the current exception, respectively. They are scope-local variables that are only defined in exception handlers (so attempting to reference them outside an exception handler is an error). Update the regression tests and the documentation. Also, do some minor related cleanup: export an unpack_sql_state() function from the backend and use it to unpack a SQLSTATE into a string, and add a free_var() function to pl_exec.c Original patch from Pavel Stehule, review by Neil Conway.
Showing
- doc/src/sgml/plpgsql.sgml 12 additions, 1 deletiondoc/src/sgml/plpgsql.sgml
- src/backend/utils/error/elog.c 22 additions, 16 deletionssrc/backend/utils/error/elog.c
- src/include/utils/elog.h 2 additions, 1 deletionsrc/include/utils/elog.h
- src/pl/plpgsql/src/gram.y 36 additions, 5 deletionssrc/pl/plpgsql/src/gram.y
- src/pl/plpgsql/src/pl_comp.c 4 additions, 4 deletionssrc/pl/plpgsql/src/pl_comp.c
- src/pl/plpgsql/src/pl_exec.c 41 additions, 20 deletionssrc/pl/plpgsql/src/pl_exec.c
- src/pl/plpgsql/src/pl_funcs.c 2 additions, 2 deletionssrc/pl/plpgsql/src/pl_funcs.c
- src/pl/plpgsql/src/plpgsql.h 9 additions, 2 deletionssrc/pl/plpgsql/src/plpgsql.h
- src/test/regress/expected/plpgsql.out 54 additions, 0 deletionssrc/test/regress/expected/plpgsql.out
- src/test/regress/sql/plpgsql.sql 44 additions, 0 deletionssrc/test/regress/sql/plpgsql.sql
Loading
Please register or sign in to comment