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.