From: | Erik Wienhold <ewie(at)ewie(dot)name> |
---|---|
To: | spamsacrime(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Split_Part w/negative integer does not work |
Date: | 2023-03-25 16:48:05 |
Message-ID: | 1711437254.453045.1679762885560@office.mailbox.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
> On 24/03/2023 21:45 CET PG Doc comments form <noreply(at)postgresql(dot)org> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/15/functions-string.html
> Description:
>
> When n is negative, an error occurs.
>
> Documentation
> split_part ( string text, delimiter text, n integer ) → text
> Splits string at occurrences of delimiter and returns the n'th field
> (counting from one), or when n is negative, returns the |n|'th-from-last
> field.
> split_part('abc~(at)~def~@~ghi', '~(at)~', 2) → def
> split_part('abc,def,ghi,jkl', ',', -2) → ghi
>
> Observation
> SELECT split_part('abc,def,ghi,jkl', ',', -1);
> generates
> ERROR: field position must be greater than zero
> SQL state: 22023
Works on 14 and 15. Support for negative indexes was added in 14. What
version do you use?
https://www.postgresql.org/docs/14/release-14.html#id-1.11.6.12.5.8
--
Erik
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-03-25 16:53:35 | Re: Split_Part w/negative integer does not work |
Previous Message | PG Doc comments form | 2023-03-25 15:43:56 | Misleading "For more information..." placement |