Re: Latest on CITEXT 2.0 - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Latest on CITEXT 2.0
Date
Msg-id 20080626161956.GC4396@alvh.no-ip.org
Whole thread Raw
In response to Re: Latest on CITEXT 2.0  ("David E. Wheeler" <david@kineticode.com>)
Responses Re: Latest on CITEXT 2.0  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
David E. Wheeler wrote:

> The operator functions *do* use PG_FREE_IF_COPY(). So I'm guessing it's 
> these functions you're talking about. However, my implementation just 
> looks like this:
>
> Datum citext_ne (PG_FUNCTION_ARGS) {
>     // Fast path for different-length inputs. Okay for canonical  
> equivalence?
>     if (VARSIZE(PG_GETARG_TEXT_P(0)) != VARSIZE(PG_GETARG_TEXT_P(1)))
>         PG_RETURN_BOOL( 1 );
>     PG_RETURN_BOOL( citextcmp( PG_ARGS ) != 0 );
> }

PG_GETARG_TEXT_P can detoast the datum, which creates a copy.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: Chris Browne
Date:
Subject: Re: Planner creating ineffective plans on LEFT OUTER joins
Next
From: Josh Berkus
Date:
Subject: Re: [0/4] Proposal of SE-PostgreSQL patches