From: Tom Lane <tgl@sss.pgh.pa.us>
To: spamsacrime@gmail.com
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Split_Part w/negative integer does not work
Date: Sat, 25 Mar 2023 12:53:35 -0400
Message-ID: <2601206.1679763215@sss.pgh.pa.us> (raw)
In-Reply-To: <167969074745.3349097.2700599411216770547@wrigleys.postgresql.org>
References: <167969074745.3349097.2700599411216770547@wrigleys.postgresql.org>
PG Doc comments form <noreply@postgresql.org> writes:
> Page: https://www.postgresql.org/docs/15/functions-string.html
> 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~@~def~@~ghi', '~@~', 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
Apparently, you are reading the v15 documentation and expecting it
to be exactly correct for some older server version. The described
behavior came in in v14.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: tgl@sss.pgh.pa.us, spamsacrime@gmail.com, pgsql-docs@lists.postgresql.org
Subject: Re: Split_Part w/negative integer does not work
In-Reply-To: <2601206.1679763215@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox