Re: patch: enhanced get diagnostics statement 2 - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: patch: enhanced get diagnostics statement 2
Date
Msg-id 1310673315-sup-4247@alvh.no-ip.org
Whole thread Raw
In response to Re: patch: enhanced get diagnostics statement 2  ("David E. Wheeler" <theory@kineticode.com>)
Responses Re: patch: enhanced get diagnostics statement 2
List pgsql-hackers
A couple items for this patch:

The docs state that the variable to receive each diagnostic value needs
to be "of the right data type" but fails to specify what it is.  I think
it'd be good to turn that <itemizedlist> into a table with three
columns: name, type, description.

This seems poor style:

+                               case PLPGSQL_GETDIAG_ERROR_CONTEXT:
+                               case PLPGSQL_GETDIAG_ERROR_DETAIL:
+                               case PLPGSQL_GETDIAG_ERROR_HINT:
+                               case PLPGSQL_GETDIAG_RETURNED_SQLSTATE:
+                               case PLPGSQL_GETDIAG_MESSAGE_TEXT:
+                                   if (!$2)
+                                       ereport(ERROR,
+                                           (errcode(ERRCODE_SYNTAX_ERROR),
+                                            errmsg("EXCEPTION_CONTEXT or EXCEPTION_DETAIL or EXCEPTION_HINT or
RETURNED_SQLSTATEor MESSAGE_TEXT are not allowed in current diagnostics statement"),
 
+                                                    parser_errposition(@1)));
+                                   


I think we could replace this with something like

+                                   if (!$2)
+                                       ereport(ERROR,
+                                           (errcode(ERRCODE_SYNTAX_ERROR),
+                                            errmsg("diagnostic value %s is not allowed in GET CURRENT DIAGNOSTICS
statement",stringify(ditem->kind)),
 


Other than that, and a few grammar fixes in code comments, this seems
good to me.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: pg_class.relistemp
Next
From: Bruce Momjian
Date:
Subject: Re: Need help understanding pg_locks