From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Nikhil Benesch <nikhil(dot)benesch(at)gmail(dot)com> |
Cc: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: split_part for the last element |
Date: | 2020-10-23 18:20:50 |
Message-ID: | CAKFQuwZyK0NOuy5jaaV_VuSh1x7SKyTgcvaM0mwCaxfZ=QNBhg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Oct 23, 2020 at 8:47 AM Nikhil Benesch <nikhil(dot)benesch(at)gmail(dot)com>
wrote:
> Is there another option I'm missing? Would there be interest in
> extending split part so that negative indices counted from the end, as
> in:
>
> split_part('foo bar baz', ' ', -1) -> 'baz'
>
Some thoughts:
I'm torn here because this would be the first usage of this concept in
PostgreSQL (I think).
Tangentially, I noticed that we have a "starts_with" function but no
corresponding "end_with".
It's been a while but there used to be a systemic inertia working
against adding minor useful functions such as these.
With the new documentation layout I would at least consider updating the
description for the normal functions with an example on how to formulate an
expression that works contra-normally, and in the case where there does
exist such a specialized function, naming it.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-10-23 18:35:00 | Re: split_part for the last element |
Previous Message | Nikhil Benesch | 2020-10-23 17:27:47 | Re: split_part for the last element |