On Aug 24, 2006, at 12:58 , Andrew J. Kopciuch wrote:

On Thursday 24 August 2006 10:34, Stefan Kaltenbrunner wrote:
We just had a complaint on IRC that:

devel=# select 'blah foo bar'::tsvector = 'blah foo bar'::tsvector;
(1 row)

This could be an endianess issue?

This was probably the same person who posted this on the OpenFTS list.

He's compiled from source :

dew=# select version();
PostgreSQL 8.1.4 on powerpc-apple-darwin8.6.0, compiled by GCC
powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build

I don't have any access to an OSX box to verify things ATM. I am trying to get access to one though. :S Can someone else verify this right now?

Stefan said he reproduced on OpenBSD/i386 so it is unlikely to be an endianness issue. Anyway, here's the comparison code- I guess it doesn't use strcmp to avoid encoding silliness. (?)

static int
silly_cmp_tsvector(const tsvector * a, const tsvector * b)
        if (a->len < b->len)
                return -1;
        else if (a->len > b->len)
                return 1;
        else if (a->size < b->size)
                return -1;
        else if (a->size > b->size)
                return 1;
unsigned char *aptr = (unsigned char *) (a->data) + DATAHDRSIZE; unsigned char *bptr = (unsigned char *) (b->data) + DATAHDRSIZE;

                while (aptr - ((unsigned char *) (a->data)) < a->len)
                        if (*aptr != *bptr)
                                return (*aptr < *bptr) ? -1 : 1;
        return 0;

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?


Reply via email to