Re: proposal: prefix function

From: Chris Travers <chris(dot)travers(at)adjust(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: prefix function
Date: 2018-09-21 10:37:28
Message-ID: CAN-RpxCYJZjxng587z1429r-HpneFh39zo-poeTXdy1WSXn9yA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 21, 2018 at 10:09 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
wrote:

> Hi
>
> can we implement prefix function for fast test if substr is prefix of some
> string?
>
> create or replace function prefix(str text, substr text)
> returns boolean as $$
> select substr(str, 1, length(substr)) = substr
> $$ language sql;
>
> This function can be very effective in C language. Now it should be
> implemented with like or regexp, what is significantly more expensive.
>
>
These would just be wrappers around already existing internal functions,
right?

> Regards
>
> Pavel
>

--
Best Regards,
Chris Travers
Head of Database

Tel: +49 162 9037 210 | Skype: einhverfr | www.adjust.com
Saarbrücker Straße 37a, 10405 Berlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2018-09-21 11:03:01 Re: Problem while updating a foreign table pointing to a partitioned table on foreign server
Previous Message Chris Travers 2018-09-21 10:35:46 Re: Proposal for Signal Detection Refactoring