I am considering the utility value of creating a functional index on a name
field. To minimize the number of invalid searches caused by spacing errors
and mis-matched lettercase I am contemplating doing something like this:
CREATE UNIQUE INDEX idxUF_table_column ON table
(lower(trim(both ' ' from(regexp_replace(<column>, /( ){2,}/g," " )))))
What I intend this to do is to squeeze out excess whitespace, strip off
leading and trailing blanks, and then force the whole thing to lowercase.
Is this idea worth pursuing and, if it is, is my regexp correct for the
purpose intended?
Not a regexp guy.
--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3