Re: Problems with Error Messages wrt Domains, Checks - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Problems with Error Messages wrt Domains, Checks
Date
Msg-id 1141.1521475881@sss.pgh.pa.us
Whole thread Raw
In response to Re: Problems with Error Messages wrt Domains, Checks  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Problems with Error Messages wrt Domains, Checks  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Mon, Mar 19, 2018 at 8:33 AM, Tom Lane <tgl@sss.pgh.pa.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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: parallel append vs. simple UNION ALL
Next
From: "David G. Johnston"
Date:
Subject: Re: Problems with Error Messages wrt Domains, Checks