Re: Collation rules and multi-lingual databases - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Collation rules and multi-lingual databases
Date
Msg-id 3F47D7BE.3090505@joeconway.com
Whole thread Raw
In response to Re: Collation rules and multi-lingual databases  (Greg Stark <gsstark@mit.edu>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Dave Cramer
Date:
Subject: ambiguous sql states
Next
From: Peter Eisentraut
Date:
Subject: Re: ambiguous sql states