Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Hackers > Re: PATCH: CITE...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 15 Topic 9610 of 11009
Post > Topic >>

Re: PATCH: CITEXT 2.0

by david@[EMAIL PROTECTED] ("David E. Wheeler") Jul 4, 2008 at 10:39 PM

On Jul 3, 2008, at 09:53, Alvaro Herrera wrote:

>> Thanks. What would citext_hash() look like? I don't see a  
>> text_hash() to
>> borrow from anywhere in src/.
>
> See hash_any().  I assume the difficulty is making sure that
> hash("FOO") = hash("foo") ...

Great, big help, thank you. So does this look sensible?

Datum
citext_hash(PG_FUNCTION_ARGS)
{
     char       *txt;
     char       *str;
     Datum       result;

     txt = cilower( PG_GETARG_TEXT_PP(0) );
     str = VARDATA_ANY(txt);

     result = hash_any((unsigned char *) str, VARSIZE_ANY_EXHDR(txt));

     /* Avoid leaking memory for toasted inputs */
     PG_FREE_IF_COPY(txt, 0);
     pfree( str );

     return result;
}

And how might I be able to test that it actually works?

Best,

David

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
 




 15 Posts in Topic:
Re: PATCH: CITEXT 2.0
Zdenek.Kotala@[EMAIL PROT  2008-07-02 18:13:52 
Re: PATCH: CITEXT 2.0
teodor@[EMAIL PROTECTED]   2008-07-02 23:18:49 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-02 21:40:12 
Re: PATCH: CITEXT 2.0
teodor@[EMAIL PROTECTED]   2008-07-03 11:19:26 
Re: PATCH: CITEXT 2.0
teodor@[EMAIL PROTECTED]   2008-07-03 11:31:06 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-03 09:03:10 
Re: PATCH: CITEXT 2.0
alvherre@[EMAIL PROTECTED  2008-07-03 12:53:15 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-04 22:39:54 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-02 21:38:32 
Re: PATCH: CITEXT 2.0
tgl@[EMAIL PROTECTED] (T  2008-07-03 01:14:14 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-03 09:01:17 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-04 22:54:45 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-04 23:06:36 
Re: PATCH: CITEXT 2.0
tgl@[EMAIL PROTECTED] (T  2008-07-05 11:13:20 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-05 17:47:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 8:52:48 CST 2008.