Sender: owner-postgres95@postgres.Berkeley.EDU
X-Return-Path: andrew_yu
Received: from george.ach.uams.edu (george.ach.uams.edu [144.30.128.1]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with SMTP id TAA26406 for <postgres95@postgres.Berkeley.EDU>; Mon, 6 Nov 1995 19:34:32 -0800
Received: by george.ach.uams.edu (4.1/SMI-4.1)
	id AA14266; Mon, 6 Nov 95 21:31:18 CST
Date: Mon, 6 Nov 1995 21:31:17 -0600 (CST)
From: "Alvis D. Harding Jr." <adh@george.ach.uams.edu>
To: postgres95@postgres.Berkeley.EDU
Subject: Is this OK to do for case-insensitive like matching?
Message-Id: <Pine.SUN.3.91.951106210617.14247A-100000@george.ach.uams.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Resent-To: postgres95-redist
Resent-Date: Mon, 06 Nov 95 19:34:33 -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';.  

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.
 
                                                                -Alvis

+----------------------------------------------------------------------------+
Alvis Harding Jr.                                 Arkansas Children's Hospital
Systems Analyst                                         Cardiac Imaging Center
(501) 320-3613                                           Little Rock, AR 72202
adh@george.ach.uams.edu                           http://www.ach.uams.edu/~adh


===============================================================================
  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/  ===========
