Ted Yu <yuzhihong@gmail.com> writes:
> On Fri, Dec 23, 2022 at 1:22 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Ted Yu <yuzhihong@gmail.com> writes:
>>> + /* See regexp.c for explanation */
>>> + CHECK_FOR_INTERRUPTS();
>> Yes, it is. We don't want a query-cancel transformed into a soft error.
> `ereturn(escontext` calls appear in multiple places in the patch.
> What about other callsites (w.r.t. checking interrupt) ?
What about them? The reason this one is special is that backend/regexp
might return a failure code that's specifically "I gave up because
there's a query cancel pending". We don't want to report that as a soft
error. It's true that we might cancel the query for real a bit later on
even if this check weren't here, but that doesn't mean it's okay to go
down the soft error path and hope that there'll be a CHECK_FOR_INTERRUPTS
sometime before there's any visible evidence that we did the wrong thing.
regards, tom lane