Re: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING
Date: 2014-08-25 15:14:02
Message-ID: 12352.1408979642@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
> On 08/25/2014 04:48 PM, Tom Lane wrote:
>> [ scratches head... ] Surely similar_escape is marked immutable, and
>> will therefore be executed exactly once in either of these formulations,
>> because the planner will fold the expression to a constant.

> Yeah, just noticed that myself..

... although, given that, it is also fair to wonder how much the speed of
similar_escape really matters. Surely in most use-cases the pattern and
escape char will be constants. And, when they are not, wouldn't the
subsequent parsing work for the regexes dominate the cost of
similar_escape anyway?

IOW, I'm not sure we should be advising Jeff to duplicate code in
order to have a fast path. Keeping it short might be the best goal.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-08-25 15:17:19 Re: SKIP LOCKED DATA (work in progress)
Previous Message Heikki Linnakangas 2014-08-25 15:04:50 Re: Unwanted LOG during recovery of DROP TABLESPACE REDO