From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: umuttechin@gmail.com
Subject: Modifying Arrays
Date: Mon, 27 Feb 2023 13:53:27 +0000
Message-ID: <167750600710.23480.2189471451420785675@wrigleys.postgresql.org> (raw)
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/15/arrays.html
Description:
According to the official document of PostgreSQL 15, in the section 8.15.4.
Modifying Arrays there is a statement like:
The slice syntaxes with omitted lower-bound and/or upper-bound can be used
too, but only when updating an array value that is not NULL or
zero-dimensional (otherwise, there is no existing subscript limit to
substitute).
This statement is not true for the following statements or I am missing
something?
CREATE TABLE sal_emp (
name text,
pay_by_quarter integer[],
schedule text[][]
);
INSERT INTO sal_emp
VALUES ('Bill',
'{10000, 10000, 10000, 10000}',
'{{"meeting", "lunch"}, {"training", "presentation"}}');
INSERT INTO sal_emp
VALUES ('Carol',
'{20000, 25000, 25000, 25000}',
'{{"breakfast", "consulting"}, {"meeting", "lunch"}}');
INSERT INTO sal_emp
VALUES ('Carolx',
'{20000, 25001, 25002, 25003}',
'{{"breakfastx", "consultingx"}, {"meetingx", "lunchx"}, {"meetingy",
"lunchy"}}');
INSERT INTO sal_emp
VALUES ('Sam',
'{20000, 25001, 25002, 25003}',
'{}');
INSERT INTO sal_emp
VALUES ('Pam',
'{20000, 25001, 25002, 25003}');
SELECT * FROM sal_emp;
UPDATE sal_emp SET schedule[1:2] = '{"asd", "asa"}'
WHERE name = 'Sam';
UPDATE sal_emp SET schedule[1:2] = '{"x", "y"}'
WHERE name = 'Pam';
SELECT * FROM sal_emp;
In order to test it: https://dbfiddle.uk/pHKY32u0
Thanks!
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: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, umuttechin@gmail.com
Subject: Re: Modifying Arrays
In-Reply-To: <167750600710.23480.2189471451420785675@wrigleys.postgresql.org>
* 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