Diagnostics statement

Z PostgreSQL
Skočit na navigaci Skočit na vyhledávání

Get exception or completion condition information from the diagnostics area. You can use following diagnostic keys: ROW_COUNT, RESULT_OID, RETURNED_SQLSTATE, MESSAGE_TEXT, MESSAGE_LENGTH, PG_MESSAGE_HINT, PG_MESSAGE_DETAIL, CONSTRAINT_NAME. The standard knows others keys, but relevant information for these keys are not collected in PostgreSQL core, and therefore cannot by used in PL/pgPSM.

Syntax

GET [CURRENT|STACKED] DIAGNOSTICS [(CONDITION|EXCEPTION) deep] variable = key [,...];

Values for keys are taken from stacked areas. With new exception handler, current diagnostic values are stacked, and copied. After exception handler, diagnostic area is reloaded from stack. Statements evaluation modify current diagnostic area. Stacked diagnostic values can be accessed only with GET STACKED DIAGNOSTICS statement. This statement can be used everywhere in exception handler body.