add some errhint for regexp* functions.

Started by jian he2 days ago2 messages
#1jian he
jian he
jian.universality@gmail.com
1 attachment(s)

hi.

Some of the regexp* function error messages seem not very helpful, I think.
like:
ereport(ERROR,
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid value for parameter \"%s\": %d",
"start", start));

so I added a errhint, errhint would be better than refactoring existing errmsg.
for the above example, I've add:

+ errhint("\"%s\" must be an integer value greater than zero", "start")));

--
jian
https://www.enterprisedb.com

Attachments:

v1-0001-regex-function-add-errhint.patchtext/x-patch; charset=US-ASCII; name=v1-0001-regex-function-add-errhint.patch
#2Tom Lane
Tom Lane
tgl@sss.pgh.pa.us
In reply to: jian he (#1)
Re: add some errhint for regexp* functions.

jian he <jian.universality@gmail.com> writes:

Some of the regexp* function error messages seem not very helpful, I think.
like:
ereport(ERROR,
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid value for parameter \"%s\": %d",
"start", start));

so I added a errhint, errhint would be better than refactoring existing errmsg.
for the above example, I've add:

+ errhint("\"%s\" must be an integer value greater than zero", "start")));

There are probably hundreds of other places where the ereport
doesn't provide such detail, and I don't see that this adds
much. If you don't understand why a negative value isn't OK,
you still need to go RTFM.

(This message doesn't follow our style guidelines, either.)

regards, tom lane