From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Steve <cheetah(at)tanabi(dot)org> |
Cc: | PostgreSQL Performance <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Strangely Variable Query Performance |
Date: | 2007-04-12 22:22:49 |
Message-ID: | 9457.1176416569@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches pgsql-performance |
Steve <cheetah(at)tanabi(dot)org> writes:
> Datum ddd_text_revcmp(PG_FUNCTION_ARGS){
> char* arg1=(char*)VARDATA(PG_GETARG_TEXT_P(0));
> char* arg2=(char*)VARDATA(PG_GETARG_TEXT_P(1));
> if((*arg1) != (*arg2)){
> PG_RETURN_INT32(*arg2 - *arg1);
> }else{
> PG_RETURN_INT32(strcmp(arg2,arg1));
> }
> }
[ itch... ] That code is just completely wrong, because the contents
of a TEXT datum aren't guaranteed null-terminated. It'd be better to
invoke bttextcmp and negate its result.
That's not relevant to your immediate problem, but if you've noticed
any strange behavior with your text_revop indexes, that's the reason...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2007-04-12 22:24:20 | Re: So are we calling it: Feature Freeze? |
Previous Message | Guido Neitzer | 2007-04-12 22:18:14 | Re: Slow Postgresql server |
From | Date | Subject | |
---|---|---|---|
Next Message | Steve | 2007-04-12 22:24:48 | Re: Strangely Variable Query Performance |
Previous Message | Guido Neitzer | 2007-04-12 22:18:14 | Re: Slow Postgresql server |
From | Date | Subject | |
---|---|---|---|
Next Message | Steve | 2007-04-12 22:24:48 | Re: Strangely Variable Query Performance |
Previous Message | Guido Neitzer | 2007-04-12 22:18:14 | Re: Slow Postgresql server |