Re: Select where (upper(xy)~'.CH'); ..matches also SPACE CH

From: "D(dot) Jay Newman" <jay(at)sprucegrove(dot)com>
To: marcel(at)simmcomm(dot)ch, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Select where (upper(xy)~'.CH'); ..matches also SPACE CH
Date: 2000-10-26 14:56:05
Message-ID: 200010261456.e9QEu5J14196@sprucegrove.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>Marcel (marcel(at)simmcomm(dot)ch) reports a bug with a severity of 3
>The lower the number the more severe it is.
>
>Short Description
>Select where (upper(xy)~'.CH'); ..matches also SPACE CH
>
>Long Description
>There exists a problem with the ~ statement. The codesample and the text is
>from an adult contact database.
>
>The compare string .CH matches the word 'EINEN CHANCE' in the sentence.
>Seems to be, that the . will match the space between the words. This
>doesn't happen, if you replace .CH with _CH or something else.

Strange. The string '.CH' should match any single character directly
followed by 'CH'. It *should* match '_CH' as well as ' CH'.

If you want the "." to match something, then use the appropriate list
[a-zA-Z] for alphabetical characters and suchwhat. If you want to match
the "." character, then use '\.CH'.

Question: why aren't you using ~* (which does a case insensitive match)
rather than upper(xy) ~ '.CH'? I haven't done benchmarking so I don't
know which is faster...

I hope this helps.
--
D. Jay Newman ! For the pleasure and the profit it derives
jay(at)sprucegrove(dot)com ! I arrange things, like furniture, and
http://www.sprucegrove.com/~jay/ ! daffodils, and ...lives. -- Hello Dolly

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2000-10-26 15:19:47 Re: Select where (upper(xy)~'.CH'); ..matches also SPACE CH
Previous Message Sean Kelly 2000-10-26 14:23:44 Re: Updating multiple bool values crashes backend