diff options
author | Neil Conway <neilc@samurai.com> | 2005-06-10 16:23:11 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2005-06-10 16:23:11 +0000 |
commit | d46bc444ac0f2b4c027e624c10bc8d49ffbe2a2f (patch) | |
tree | a67d32556ae2e472c90963ee5ec63992c4e50149 /src/include/utils/elog.h | |
parent | 1a61896189c54dbbb63973d45f59c73fd2f4b44c (diff) |
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.
Diffstat (limited to 'src/include/utils/elog.h')
-rw-r--r-- | src/include/utils/elog.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index 0b7d3f17ebb..f226f772911 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.78 2004/12/31 22:03:46 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.79 2005/06/10 16:23:10 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -282,6 +282,7 @@ extern int Log_destination; /* Other exported functions */ extern void DebugFileOpen(void); +extern char *unpack_sql_state(int sql_state); /* * Write errors to stderr (or by equal means when stderr is |