Re: tsvector/tsearch equality and/or portability issue issue ?

Поиск
Список
Период
Сортировка
От AgentM
Тема Re: tsvector/tsearch equality and/or portability issue issue ?
Дата
Msg-id C083305F-ED80-4A2A-B6A4-C32096D72994@themactionfaction.com
обсуждение исходный текст
Ответ на Re: tsvector/tsearch equality and/or portability issue issue ?  ("Andrew J. Kopciuch" <akopciuch@bddf.ca>)
Ответы Re: tsvector/tsearch equality and/or portability issue
Список pgsql-hackers
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;
>>  ?column?
>> ----------
>>  f
>> (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 :
>
> <snip>
> 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
>  5250)
> </snip>
>
> 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;
else        {                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;                        aptr++;
      bptr++;                }        }        return 0;
 
}



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Teodor Sigaev
Дата:
Сообщение: Re: tsvector/tsearch equality and/or portability issue
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Autovacuum on by default?