Re: patch: enhanced get diagnostics statement 2

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: "David E(dot) Wheeler" <theory(at)kineticode(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>
Subject: Re: patch: enhanced get diagnostics statement 2
Date: 2011-07-14 20:25:56
Message-ID: CAFj8pRD8c-1U+VUy+PVAu-x6avrQEmcZ4qH-4TVwd=902jRL-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2011/7/14 Alvaro Herrera <alvherre(at)commandprompt(dot)com>:
> 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_SQLSTATE or 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.
>

it is good idea

Regards

Pavel

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-07-14 20:26:13 Re: pg_class.relistemp
Previous Message Bruce Momjian 2011-07-14 20:18:09 Re: Need help understanding pg_locks