fix_getdiag_doc.patch

text/plain

Filename: fix_getdiag_doc.patch
Type: text/plain
Part: 0
Message: Re: patch: enhanced get diagnostics statement 2
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 3d07b6e..7df69a7 100644
*** a/doc/src/sgml/plpgsql.sgml
--- b/doc/src/sgml/plpgsql.sgml
*************** EXECUTE format('UPDATE tbl SET %I = $1 W
*** 1387,1393 ****
       command, which has the form:
  
  <synopsis>
! GET <optional> CURRENT | STACKED </optional> DIAGNOSTICS <replaceable>variable</replaceable> = <replaceable>item</replaceable> <optional> , ... </optional>;
  </synopsis>
  
       This command allows retrieval of system status indicators.  Each
--- 1387,1393 ----
       command, which has the form:
  
  <synopsis>
! GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable> = <replaceable>item</replaceable> <optional> , ... </optional>;
  </synopsis>
  
       This command allows retrieval of system status indicators.  Each
*************** GET DIAGNOSTICS integer_var = ROW_COUNT;
*** 1486,1506 ****
       affect only the current function.
      </para>
  
      <para>
!       Inside a exception handler is possible to use a stacked diagnostics statement. It 
!       allows a access to exception's data: the <varname>RETURNED_SQLSTATE</varname> contains
!       a SQLSTATE of handled exception. <varname>MESSAGE_TEXT</varname> contains a message text,
!       <varname>PG_EXCEPTION_DETAIL</varname> has a text that is shown as exception detail,
!       <varname>PG_EXCEPTION_HINT</varname> has a hint related to catched exception.
!       <varname>PG_EXCEPTION_CONTEXT</varname> contains a lines that describes call stack. These
!       variables holds a text value. When some field of exception are not filled, then related 
!       variable contains a empty string,
      </para>
  
      <para>
!      An example:
  <programlisting>
  BEGIN
    ...
  EXCEPTION WHEN OTHERS THEN
    GET STACKED DIAGNOSTICS text_var1 = MESSAGE_TEXT,
--- 1486,1523 ----
       affect only the current function.
      </para>
  
+    </sect2>
+ 
+    <sect2 id="plpgsql-exception-diagnostics">
+     <title>Obtaining the Exception Status</title>
+ 
      <para>
!      Inside an exception handler, it's possible to retrieve detailed
!      information about the exception which is currently handled, with using a
!      <command>GET STACKED DIAGNOSTICS</command> command, which has the form:
! 
! <synopsis>
! GET STACKED DIAGNOSTICS <replaceable>variable</replaceable> = <replaceable>item</replaceable> <optional> , ... </optional>;
! </synopsis>
      </para>
  
      <para>
!      It allows you to access to exception's data: the
!      <varname>RETURNED_SQLSTATE</varname> contains a SQLSTATE of handled
!      exception. <varname>MESSAGE_TEXT</varname> contains a message text,
!      <varname>PG_EXCEPTION_DETAIL</varname> has a text that is shown as
!      exception detail, <varname>PG_EXCEPTION_HINT</varname> has a hint
!      related to catched exception.  <varname>PG_EXCEPTION_CONTEXT</varname>
!      contains a lines that describes call stack. These variables holds a text
!      value. When some of exception fields are not filled, then such variable
!      contains an empty string.  An example is:
  <programlisting>
+ DECLARE
+   text_var1 text;
+   text_var2 text;
+   text_var3 text;
  BEGIN
+   -- some processing which might cause an exception
    ...
  EXCEPTION WHEN OTHERS THEN
    GET STACKED DIAGNOSTICS text_var1 = MESSAGE_TEXT,