Greg Stark wrote:
> Joe Conway <mail@joeconway.com> writes:
>
>
>>> if (sigsetjmp(Warn_restart, 1) != 0)
>>> {
>>> memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
>>> newlocale = setlocale(LC_COLLATE, oldlocale);
>>> if (!newlocale)
>>> elog(PANIC, "setlocale failed to reset locale: %s", localestr);
>>> siglongjmp(Warn_restart, 1);
>>> }
>
>
> Well presumably we want FATAL not PANIC.
Yeah, that was a bit overzealous. I really intended FATAL.
> And do we still need HOLD_INTERRUPTS() .. RESUME_INTERRUPTS() ?
I'm not sure, but I think not.
> I was afraid that was getting into bed too much with the error handling. I
> have an implementation that restores the locale around the palloc and
> increases the initial guess for future calls to avoid degenerate behaviour.
Well the intention of the sigsetjmp was to avoid the need to flip the
locale to-and-fro. Increasing the initial guess might be good, but it
will further restrict the length of the input string you can work with.
But I'd guess you'll not want to use this with extremely long strings
anyway.
Joe