From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Chris Travers <chris(dot)travers(at)adjust(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal: prefix function |
Date: | 2018-09-21 17:29:02 |
Message-ID: | CAFj8pRD+uv6Z9uXyKabhfnpou4gDLsq4-cxN-UncsnaeEsPn5Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
pá 21. 9. 2018 v 12:37 odesílatel Chris Travers <chris(dot)travers(at)adjust(dot)com>
napsal:
>
>
> 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?
>
It is already - I forgot
starts_with
It is PostgreSQL 11 feature 710d90da1fd8c1d028215ecaf7402062079e99e9
I like when I can do nothing :)
Pavel
>
>> 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
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2018-09-21 17:35:28 | pg_atomic_exchange_u32() in ProcArrayGroupClearXid() |
Previous Message | Robert Haas | 2018-09-21 16:46:50 | Re: pgsql: Improve autovacuum logging for aggressive and anti-wraparound ru |