Re: Mention column name in error messages

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Franck Verrot <franck(at)verrot(dot)fr>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Mention column name in error messages
Date: 2015-08-19 21:31:33
Message-ID: CAMkU=1weeowOfvL-tcWXgKGk_uNenOMtkG5Ky8ZtvzN9FpOs3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 9, 2015 at 8:44 AM, Franck Verrot <franck(at)verrot(dot)fr> wrote:

> On Wed, Jul 1, 2015 at 12:30 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>> What seems more likely to lead to a usable patch is to arrange for the
>> extra information you want to be emitted as error "context", via an error
>> context callback that gets installed at the right times. ...
>> ...
>> with no need for int8in to be directly aware of the context. You should
>> try adapting that methodology for the cases you're worried about.
>>
>
> Hi Tom (and others),
>
> Sorry it took so long for me to follow up on this, hopefully I found a
> couple
> a hours today to try writing another patch.
>
> In any case, thanks for reviewing my first attempt and taking time to write
> such a detailed critique... I've learned a lot!
>
> I am now using the error context callback stack. The current column name
> and column type are passed to the callback packed inside a new structure
> of type "TransformExprState".
> Those information are then passed to `errhint` and will be presented to the
> user later on (in case of coercion failure).
>
>
> Please find the WIP patch attached.
> (I've pushed the patch on my GH fork[1] too).
>

Hi Franck,

I like the idea of having the column name.

I took this for a test drive, and had some comments.on the user visible
parts.

The hints you add end in a new line, which then gives two new lines once
they are emitted. This is contrary to how other HINTs are formatted.

Other HINTs are complete sentences (start with a capital letter, end with a
period).

But I think these belong as CONTEXT or as DETAIL, not as HINT. The
messages are giving me details about where (which column) the error
occured, they aren't giving suggestions to me about what to do about it.

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jacques klein 2015-08-19 21:33:59 Re: how to write/setup a C trigger function in a background worker
Previous Message Alvaro Herrera 2015-08-19 21:17:55 Re: how to write/setup a C trigger function in a background worker