Sender: owner-postgres95@postgres.Berkeley.EDU
X-Return-Path: andrew_yu
Received: from methi.ndim.edrc.cmu.edu (METHI.NDIM.EDRC.CMU.EDU [128.2.214.230]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with SMTP id UAA18782 for <postgres95@nobozo.cs.berkeley.edu>; Mon, 6 Nov 1995 20:27:44 -0800
Message-Id: <199511070427.UAA18782@nobozo.CS.Berkeley.EDU>
Received: from localhost by methi.ndim.edrc.cmu.edu id aa02723;
          6 Nov 95 23:27 EST
X-Mailer: exmh version 1.6.2 7/18/95
To: "Alvis D. Harding Jr." <adh@george.ach.uams.edu>,
    postgres95@postgres.Berkeley.EDU
Reply-to: rp2y+@CS.cmu.edu
Subject: Re: Is this OK to do for case-insensitive like matching? 
References: <Pine.SUN.3.91.951106210617.14247A-100000@george.ach.uams.edu> 
In-reply-to: Your message of "Mon, 06 Nov 1995 21:31:17 CST."
             <Pine.SUN.3.91.951106210617.14247A-100000@george.ach.uams.edu> 
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Mon, 06 Nov 1995 23:27:16 -0500
From: Robert Patrick <Robert_Patrick@methi.ndim.edrc.cmu.edu>
Resent-To: postgres95-redist
Resent-Date: Mon, 06 Nov 95 20:27:47 -0800
Resent-From: pglite
Resent-XMts: smtp

> Well, I'm new to Postgres95 and this list but it seems that everyone 
> wants to do case-insensitive (CI) searches.  And so do I!  I've implemented 
> an email database on the WWW using Postgres95 and pg95perl5 and wanted to 
> do to CI searches on the name, department, and email address columns.  
> These fields are of the type 'text'.  What I've done is modify the 
> function DoMatch( ) in src/backend/utils/adt/like.c and changed the default 
> section of the case to:  
> 
> if (tolower(*text) != tolower(*p))  
> 
> So now all of my like searches are CI (which I can live with since 
> most of my searches are substring searches).  Is this kosher?  Everything 
> seems to be working great so far...  I didn't want to do the messy regexp 
> scene as I thought this would slow me down quite a bit.
> 
> Now, I'd like to also implement CI searches using the equality operators 
> on the 'text' fields.  I *believe* that the function array_eq( ) in 
> arrayfuncs.c is called to do this.  Uh oh, there's a memcmp( ) there.  
> Not as easy to convert to CI. 
>
> Question 1)  Is this the function that gets called for equality 
> operations on 'text' fields?  e.g. select * from email where last_name = 
> 'doe';.  

Don't think so...  Try texteq()

> 
> Question 2)  Does someone have a "cheat sheet" that lists the various low 
> level comparison routines that are called for the various data types?  
> I'm new to the source and haven't yet made the connection between data 
> type and the routines that are called when those data types are operated 
> upon.

Try looking at src/backend/catalog/pg_proc.h.  The code is not too easy to read but you can get a feel for most of the "builtin" functions.  For example:

DATA(insert OID =  67 (  texteq            PGUID 11 f t f 2 f 16 "25 25" 100 0 0
 0  foo bar ));

texteq is the name of the function
"25 25" is the types of the two things being compared (25 == text)
16 is the return type (16 == bool)

Hope this helps,
Robert



===============================================================================
  To unsubscribe from the Postgres95 mailing list, send mail with the subject
  line "DEL" to "postgres95-request@postgres.Berkeley.EDU". 
============  URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres95/  ===========
