Re: the case for machine-readable error fields

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: the case for machine-readable error fields
Date: 2009-08-04 19:14:45
Message-ID: 20090804191445.GN6494@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > First we need several new error message fields: table name, function
> > name, constraint name, and so on.
>
> It would also help to have clear definitions of what these *mean*, which
> is entirely unclear from your comments --- in particular, the reference
> to errcontext callbacks confuses the heck out of me. I would have
> thought that these would be used for the referenced object name in cases
> like "table not found", and surely using an errcontext callback for that
> would be the hardest possible way to implement it.

Huh, yeah, certainly there are cases where the errtable() call is going
to be directly in the ereport() call instead of errcontext, but in some
other cases (for example when reporting problems in functions) we're
going to need errcontext.

> Lastly, I'm not as sure as you are that the case for these is well made.
> In exactly what cases would client code be able to do something useful
> with them? Your proposal involves a pretty huge amount of work if we
> are to carry it out thoroughly, and I'm 100% not convinced that there's
> a proportional benefit.

Hmm, well, I skipped the rationale because it has been requested before.
For example, we need to give constraint names so that applications can
tell which unique key is being violated. We need table names on which
they are being violated. We need column names for datatype mismatches,
and so on. We frequently see people parsing the error message to
extract those, but that is known to be fragile, cumbersome and error
prone.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-04 20:05:17 Re: the case for machine-readable error fields
Previous Message Pavel Stehule 2009-08-04 18:22:05 Re: mixed, named notation support