Re: COLLATE

From: Kevin Murphy <murphy(at)genome(dot)chop(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: COLLATE
Date: 2006-08-17 15:01:31
Message-ID: 44E484CB.5090209@genome.chop.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Kevin Murphy <murphy(at)genome(dot)chop(dot)edu> writes:
>> What is the answer to Filip's question? I didn't see an answer in the list archives. I've seen several copies of Joe Conway's pg_strxfrm.c code on the web, and it always refers to the Warn_restart variable, which doesn't seem to exist in the 8.1.4 code that I'm using.
>
> Warn_restart hasn't existed since PG 7.4. I would imagine that the code
> needs to be tweaked to use a PG_TRY construct instead of direct setjmp
> hacking.

Yes, I'm a user, not a hacker. I was hoping that someone had done this
already. Anyway, I gave PG_TRY a try, and the code superficially works.
I have no idea what I'm doing; you can see what I did below.

Confirm that instead of:

memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
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);
}
...
code here
...
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));

it should be:

PG_TRY();
{
...
code here
...
}
PG_CATCH();
{
newlocale = setlocale(LC_COLLATE, oldlocale);
if (!newlocale)
elog(PANIC, "setlocale failed to reset locale: %s",
localestr);

}
PG_END_TRY();

Thanks,
Kevin Murphy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message AgentM 2006-08-17 15:25:04 Re: Best approach for a "gap-less" sequence
Previous Message Berend Tober 2006-08-17 14:25:28 Re: Best approach for a "gap-less" sequence