Re: Problems with Error Messages wrt Domains, Checks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: john frazer <johnfrazer783(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problems with Error Messages wrt Domains, Checks
Date: 2018-03-19 16:11:21
Message-ID: 1141.1521475881@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Mon, Mar 19, 2018 at 8:33 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> But I wonder if we wouldn't be better off to put the regex into a
>> detail line, ie
>> errmsg("invalid regular expression: %s", ...),
>> errdetail("Regular expression is \"%s\".", ...),

> I'd consider at least supplying the first 30 or so characters (or maybe up
> to the first newline, whichever is shorter) in the main message and then
> the entire regex in the detail line.

That seems like a lot more complication than this is worth, and it'd be
confusing to users as well, if things are formatted differently for short
and long regexes.

Also, by my count there are at least eight places in the code that
need to emit messages like this; if we turn formatting the messages into
a major production, people will take shortcuts. Some already have, eg
spell.c is failing to report pg_regexec failures at all. I thought
about trying to discourage deviations by using common error-reporting
subroutines, but there are enough legit differences in what needs to
be done that that might not work well.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2018-03-19 16:32:53 Re: Problems with Error Messages wrt Domains, Checks
Previous Message Robert Haas 2018-03-19 15:57:28 Re: parallel append vs. simple UNION ALL