Search Postgresql Archives

Re: COLLATE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane wrote:
Kevin Murphy <murphy@xxxxxxxxxxxxxxx> 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux