Greg Stark <[EMAIL PROTECTED]> writes:
> The glibc docs sample code suggests using 2x the original string
> length for the initial buffer. My testing showed that *always*
> triggered the exceptional case. A bit of experimentation lead to the
> 3x+4 which eliminates it except for 0 and 1 byte string
Stephan Szabo <[EMAIL PROTECTED]> writes:
> On Fri, 22 Aug 2003, Tom Lane wrote:
>> I'd go so far as to make it a critical section --- that ensures that any
>> ERROR will be turned to FATAL, even if it's in a subroutine you call.
> I didn't know we could do that, could be handy, although the comme
Greg Stark wrote:
Joe Conway <[EMAIL PROTECTED]> 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);
Joe Conway <[EMAIL PROTECTED]> 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",
Joe Conway wrote:
What about something like this?
Oops! Forgot to restrore error handling. See below:
Joe
8<
#include
#include
#include "postgres.h"
#include "fmgr.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#define GET_STR(textp) \
DatumGetCStri
Greg Stark wrote:
Yeah I thought of that. But if making it a critical section is cheap then it's
probably a better approach. The problem with restoring the locale for the
palloc is that if the user is unlucky he might sort a table of thousands of
strings that all trigger the exception case.
What ab
On 23 Aug 2003, Greg Stark wrote:
> Stephan Szabo <[EMAIL PROTECTED]> writes:
>
> > Since most of that work is for an exceptional case, maybe it'd be safer
> > (although slower) to structure the function as
>
> Yeah I thought of that. But if making it a critical section is cheap then it's
> probab
Stephan Szabo <[EMAIL PROTECTED]> writes:
> Since most of that work is for an exceptional case, maybe it'd be safer
> (although slower) to structure the function as
Yeah I thought of that. But if making it a critical section is cheap then it's
probably a better approach. The problem with restorin
On Fri, 22 Aug 2003, Stephan Szabo wrote:
> On Fri, 22 Aug 2003, Tom Lane wrote:
>
> > Stephan Szabo <[EMAIL PROTECTED]> writes:
> > > On 22 Aug 2003, Greg Stark wrote:
> > >> If it's deemed a reasonable approach and nobody has any fatal flaws then I
> > >> expect it would be useful to put in the
On Fri, 22 Aug 2003, Tom Lane wrote:
> Stephan Szabo <[EMAIL PROTECTED]> writes:
> > On 22 Aug 2003, Greg Stark wrote:
> >> If it's deemed a reasonable approach and nobody has any fatal flaws then I
> >> expect it would be useful to put in the contrib directory?
>
> > I'm not sure that ERROR if th
Stephan Szabo <[EMAIL PROTECTED]> writes:
> On 22 Aug 2003, Greg Stark wrote:
>> If it's deemed a reasonable approach and nobody has any fatal flaws then I
>> expect it would be useful to put in the contrib directory?
> I'm not sure that ERROR if the locale cannot be put back is sufficient
> (alth
On 22 Aug 2003, Greg Stark wrote:
>
> So, I needed a way to sort using collation rules other than the one the
> database was built with. So I wrote up the following function exposing strxfrm
> with an extra parameter to specify the LC_COLLATE value to use.
>
> This is my first C function so I'm r
Greg Stark writes:
> This is my first C function so I'm really unsure that I've done the right
> thing. For the most part I pattern-matched off the string_io code in the
> contrib directory.
That was just about the worst example you could have picked. Please
forget everything you have seen and s
So, I needed a way to sort using collation rules other than the one the
database was built with. So I wrote up the following function exposing strxfrm
with an extra parameter to specify the LC_COLLATE value to use.
This is my first C function so I'm really unsure that I've done the right
thing. F
14 matches
Mail list logo