Re: Mention column name in error messages

From: Franck Verrot <franck(at)verrot(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Mention column name in error messages
Date: 2015-08-09 15:44:06
Message-ID: CANfkH5mBP_UDjbz4ZzoDcJbXUHvv7cjrYi9Qe4LQnhv+o7x0rQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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).

Thanks again,
Franck

[1]:
https://github.com/franckverrot/postgres/commit/73dd2cd096c91cee1b501d5f94ba81037de30fd1

Attachment Content-Type Size
0001-Report-column-for-which-type-coercion-fails.patch application/octet-stream 3.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-08-09 17:23:52 Re: Assert in pg_stat_statements
Previous Message Robert Haas 2015-08-09 15:39:31 Re: Freeze avoidance of very large table.