Misleading "For more information..." placement
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/15/datatype-character.html
Description:
In the paragraph
> The characters that can be stored in any of these data types are
determined by the database character set, which is selected when the
database is
> created. Regardless of the specific character set, the character with code
zero (sometimes called NUL) cannot be stored. For more information refer to
Section 24.3.
The final sentence ("For more information refer to Section 24.3") is easily
read to refer to more information being available about character code zero
(NUL). However, section 24.3 has no mention of NUL, but rather the
available database character sets. I'd suggest moving that last sentence to
immediately after the first sentence, which ends with "...when the database
is created."
A really minor point, but it caught me off-guard.
Best,
-Randall
List Tables
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/15/tutorial-table.html Description: Would be nice to add a paragraph after create table and before delete table with list tables.
Split_Part w/negative integer does not work
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~@~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
Or in code
DO $$
DECLARE
mytxt text;
BEGIN
mytxt = split_part('abc,def,ghi,jkl', ',', -1);
RAISE NOTICE '%', mytxt;
END $$
ERROR: field position must be greater than zero
CONTEXT: SQL statement "SELECT split_part('abc,def,ghi,jkl', ',', -1)"
PL/pgSQL function inline_code_block line 6 at assignment
SQL state: 22023
Re: Split_Part w/negative integer does not work
> On 24/03/2023 21:45 CET PG Doc comments form 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~@~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
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
Re: Split_Part w/negative integer does not work
PG Doc comments form 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
