Re: PATCH: CITEXT 2.0 v4

From: Michael Paesold <mpaesold(at)gmx(dot)at>
To: David E(dot) Wheeler <david(at)kineticode(dot)com>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PATCH: CITEXT 2.0 v4
Date: 2008-07-18 08:39:23
Message-ID: B33BE1AA-D015-4428-A93D-8B305AE9050B@gmx.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David E. Wheeler writes:

> On Jul 17, 2008, at 03:45, Michael Paesold wrote:
>
>> Wouldn't it be possible to create a variant of regexp_replace, i.e.
>> regexp_replace(citext,citext,text), which would again lower-case
>> the first two arguments before passing the input to
>> regexp_replace(text,text,text)?
>
> Sure, but then you end up with this:
>
> template1=# select regexp_replace( 'Fxx'::citext, 'X'::citext, 'o');
> regexp_replace
> ----------------
> foo
> (1 row)

Yeah, you are right, I see. :-)

> Which is just wrong. I'm going to look at the regex C functions
> today and see if there's an easy way to just always pass them the
> 'i' flag, which would do the trick. That still won't help replace(),
> split_part(), or translate(), however.

Calling regex functions with the case-insensitivity option would be
great. It should also be possible to rewrite replace() into
regexp_replace() by first escaping the regex meta characters.

Actually re-implementing those functions in a case insensitive way
would still be an option, but of course some amount of work. The
question is, how much use case there is.

Best Regards
Michael Paesold

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2008-07-18 10:07:17 Re: [PATCH]-hash index improving
Previous Message Marko Kreen 2008-07-18 08:22:30 Re: TABLE-function patch vs plpgsql