|
|
RETURNED_SQLSTATE
- text
+ text>
the SQLSTATE error code of the exception
|
COLUMN_NAME
- text
+ text>
the name of the column related to exception
|
CONSTRAINT_NAME
- text
+ text>
the name of the constraint related to exception
|
PG_DATATYPE_NAME
- text
+ text>
the name of the data type related to exception
|
MESSAGE_TEXT
- text
+ text>
the text of the exception's primary message
|
TABLE_NAME
- text
+ text>
the name of the table related to exception
|
SCHEMA_NAME
- text
+ text>
the name of the schema related to exception
|
PG_EXCEPTION_DETAIL
- text
+ text>
the text of the exception's detail message, if any
|
PG_EXCEPTION_HINT
- text
+ text>
the text of the exception's hint message, if any
|
PG_EXCEPTION_CONTEXT
- text
- line(s) of text describing the call stack
+ text>
+ line(s) of text describing the call stack at the time of the
+ exception (see )
- get-diagnostics-context">
-
Obtaining Current Execu tion Information
+ call-stack">
+
Obtaining Execution Loca tion Information
- The GET CURRENT DIAGNOSTICS
- command retrieves information about current execution state (whereas
- the GET STACKED DIAGNOSTICS command discussed above
- reports information about the execution state as of a previous error).
- This command has the form:
-
-
-
-GET CURRENT DIAGNOSTICS variable { = | := } item , ... ;
-
-
- Currently only one information item is supported. Status
- item PG_CONTEXT> will return a text string with line(s) of
- text describing the call stack. The first line refers to the
- current function and currently executing GET DIAGNOSTICS
+ The GET DIAGNOSTICS command, previously described
+ in , retrieves information
+ about current execution state (whereas the GET STACKED
+ DIAGNOSTICS command discussed above reports information about
+ the execution state as of a previous error). Its PG_CONTEXT>
+ status item is useful for identifying the current execution
+ location. PG_CONTEXT> returns a text string with line(s)
+ of text describing the call stack. The first line refers to the current
+ function and currently executing GET DIAGNOSTICS
command. The second and any subsequent lines refer to calling functions
further up the call stack. For example:
+
+ GET STACKED DIAGNOSTICS ... PG_EXCEPTION_CONTEXT
+ returns the same sort of stack trace, but describing the location
+ at which an error was detected, rather than the current location.
+
- When a
PL/pgSQL function is called as a
+ When a
PL/pgSQL function is called as a
n
event trigger, several special variables are created automatically
in the top-level block. They are:
- shows an example of a
+ shows an example of an
event trigger procedure in
PL/pgSQL .
Add ability to retrieve the current PL/PgSQL call stack
- using get-diagnostics-context">GET
+ using call-stack">GET
DIAGNOSTICS>
(Pavel Stehule, Stephen Frost)