| From: | Nikhil Benesch <nikhil(dot)benesch(at)gmail(dot)com> |
|---|---|
| To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(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:38:26 |
| Message-ID: | CAPWqQZQyU35LH+PBqb8jWS94GRHUivToVFgqi=AndBP1AySSYA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Fri, Oct 23, 2020 at 2:21 PM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> I'm torn here because this would be the first usage of this concept in
> PostgreSQL (I think).
Yeah, I also have some qualms about this design in the context of Postgres.
Particularly because Postgres allows arrays to begin at negative indices.
> Tangentially, I noticed that we have a "starts_with" function but no
> corresponding "end_with".
Ah, interesting. On the other hand, there are both "left" and "right",
"lpad" and "rpad", and "ltrim" and "rtrim". And at least ends_with has the
fairly elegant alternative of "s LIKE '%suffix'".
> 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.
Supposing you go this route, which of the options would you envision
mentioning as the converse of split_part?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nikhil Benesch | 2020-10-23 18:41:57 | Re: split_part for the last element |
| Previous Message | Tom Lane | 2020-10-23 18:35:00 | Re: split_part for the last element |