Replace run-time error check with assertion

Started by Peter Eisentrautalmost 5 years ago2 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

In the attached patch, the error message was checking that the
structures returned from the parser matched expectations. That's
something we usually use assertions for, not a full user-facing error
message. So I replaced that with an assertion (hidden inside
lfirst_node()).

Attachments:

0001-Replace-run-time-error-check-with-assertion.patchtext/plain; charset=UTF-8; name=0001-Replace-run-time-error-check-with-assertion.patch; x-mac-creator=0; x-mac-type=0Download+5-17
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: Replace run-time error check with assertion

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:

In the attached patch, the error message was checking that the
structures returned from the parser matched expectations. That's
something we usually use assertions for, not a full user-facing error
message. So I replaced that with an assertion (hidden inside
lfirst_node()).

Works for me. It's certainly silly to use a translatable ereport
rather than elog for this.

Localizing those variables some more looks sane too.

regards, tom lane