pgsql: Allow length=-1 for NUL-terminated input to pg_strncoll(), etc.

2024-09-24 Thread Jeff Davis
Allow length=-1 for NUL-terminated input to pg_strncoll(), etc. Like ICU, allow a length of -1 to be specified for NUL-terminated arguments to pg_strncoll(), pg_strnxfrm(), and pg_strnxfrm_prefix(). Simplifies the code and comments. Discussion: https://postgr.es/m/2d758e07dff26bcc7cbe2aec574313

pgsql: Fix use of uninitialized value in previous commit.

2024-09-24 Thread Noah Misch
Fix use of uninitialized value in previous commit. Per buildfarm member akepa and others. Back-patch to v16 and v15. Discussion: https://postgr.es/m/20240924224352.93.nmi...@google.com Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/90f5412a9a513f2d8e4fee11

pgsql: Fix use of uninitialized value in previous commit.

2024-09-24 Thread Noah Misch
Fix use of uninitialized value in previous commit. Per buildfarm member akepa and others. Back-patch to v16 and v15. Discussion: https://postgr.es/m/20240924224352.93.nmi...@google.com Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/0cf3d41cbb425c142ca7b3f1

pgsql: Fix psql describe commands' handling of ACL columns for old serv

2024-09-24 Thread Tom Lane
Fix psql describe commands' handling of ACL columns for old servers. Commit d1379ebf4 carelessly broke printACLColumn for pre-9.4 servers, by using the cardinality() function which we introduced in 9.4. We expect psql's describe-related commands to work back to 9.2, so this is bad. Use the longst

Re: pgsql: Allow meson builds to run test_pg_dump test in installcheck mode

2024-09-24 Thread Michael Paquier
On Tue, Sep 24, 2024 at 09:42:59AM -0400, Peter Geoghegan wrote: > On Mon, Sep 23, 2024 at 11:40 PM Michael Paquier wrote: > > Allow meson builds to run test_pg_dump test in installcheck mode. > > This commit has Tom as the git author, and Michael as the git > committer. Was that intentional? As

pgsql: pg_stat_statements: Expand tests for SET statements

2024-09-24 Thread Michael Paquier
pg_stat_statements: Expand tests for SET statements There are many grammar flavors that depend on the parse node VariableSetStmt. This closes the gap in pg_stat_statements by providing test coverage for what should be a large majority of them, improving more the work begun in de2aca288569. This

pgsql: Neaten up our choices of SQLSTATEs for XML-related errors.

2024-09-24 Thread Tom Lane
Neaten up our choices of SQLSTATEs for XML-related errors. When our XML-handling modules were first written, the SQL standard lacked any error codes that were particularly intended for XML error conditions. Unsurprisingly, this led to some rather random choices of errcodes in those modules. Now

pgsql: Update obsolete nbtree array preprocessing comments.

2024-09-24 Thread Peter Geoghegan
Update obsolete nbtree array preprocessing comments. The array->scan_key references fixed up at the end of preprocessing start out as offsets into the arrayKeyData[] array (the array returned by _bt_preprocess_array_keys at the start of preprocessing that involves array scan keys). Offsets into t

pgsql: Fix data loss at inplace update after heap_update().

2024-09-24 Thread Noah Misch
Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM w

pgsql: Fix data loss at inplace update after heap_update().

2024-09-24 Thread Noah Misch
Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM w

pgsql: Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions.

2024-09-24 Thread Noah Misch
Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions. The current use always releases this locktag. A planned use will continue that intent. It will involve more areas of code, making unlock omissions easier. Warn under debug_assertions, like we do for various resource leaks. Back-p

pgsql: Back-patch "Refactor code in tablecmds.c to check and process ta

2024-09-24 Thread Noah Misch
Back-patch "Refactor code in tablecmds.c to check and process tablespace moves" Back-patch commits 4c9c359d38ff1e2de388eedd860785be6a49201c and 24843297a96d7be16cc3f4b090aacfc6e5e6839e to v13 and v12. Before those commits, we held the modifiable copy of the relation's pg_class row throughout a ta

pgsql: For inplace update durability, make heap_update() callers wait.

2024-09-24 Thread Noah Misch
For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligibl

pgsql: Fix data loss at inplace update after heap_update().

2024-09-24 Thread Noah Misch
Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM w

pgsql: Fix data loss at inplace update after heap_update().

2024-09-24 Thread Noah Misch
Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM w

pgsql: Tag refs/tags/REL_17_0 was created

2024-09-24 Thread noreply
Tag refs/tags/REL_17_0 was created.

pgsql: Fix psql describe commands' handling of ACL columns for old serv

2024-09-24 Thread Tom Lane
Fix psql describe commands' handling of ACL columns for old servers. Commit d1379ebf4 carelessly broke printACLColumn for pre-9.4 servers, by using the cardinality() function which we introduced in 9.4. We expect psql's describe-related commands to work back to 9.2, so this is bad. Use the longst

pgsql: For inplace update durability, make heap_update() callers wait.

2024-09-24 Thread Noah Misch
For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligibl

pgsql: Fix data loss at inplace update after heap_update().

2024-09-24 Thread Noah Misch
Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM w

pgsql: Fix data loss at inplace update after heap_update().

2024-09-24 Thread Noah Misch
Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM w

pgsql: For inplace update durability, make heap_update() callers wait.

2024-09-24 Thread Noah Misch
For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligibl

pgsql: Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions.

2024-09-24 Thread Noah Misch
Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions. The current use always releases this locktag. A planned use will continue that intent. It will involve more areas of code, making unlock omissions easier. Warn under debug_assertions, like we do for various resource leaks. Back-p

pgsql: For inplace update durability, make heap_update() callers wait.

2024-09-24 Thread Noah Misch
For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligibl

pgsql: Fix data loss at inplace update after heap_update().

2024-09-24 Thread Noah Misch
Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM w

pgsql: Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions.

2024-09-24 Thread Noah Misch
Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions. The current use always releases this locktag. A planned use will continue that intent. It will involve more areas of code, making unlock omissions easier. Warn under debug_assertions, like we do for various resource leaks. Back-p

pgsql: Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions.

2024-09-24 Thread Noah Misch
Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions. The current use always releases this locktag. A planned use will continue that intent. It will involve more areas of code, making unlock omissions easier. Warn under debug_assertions, like we do for various resource leaks. Back-p

pgsql: Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions.

2024-09-24 Thread Noah Misch
Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions. The current use always releases this locktag. A planned use will continue that intent. It will involve more areas of code, making unlock omissions easier. Warn under debug_assertions, like we do for various resource leaks. Back-p

pgsql: For inplace update durability, make heap_update() callers wait.

2024-09-24 Thread Noah Misch
For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligibl

pgsql: Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions.

2024-09-24 Thread Noah Misch
Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions. The current use always releases this locktag. A planned use will continue that intent. It will involve more areas of code, making unlock omissions easier. Warn under debug_assertions, like we do for various resource leaks. Back-p

pgsql: For inplace update durability, make heap_update() callers wait.

2024-09-24 Thread Noah Misch
For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligibl

pgsql: For inplace update durability, make heap_update() callers wait.

2024-09-24 Thread Noah Misch
For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligibl

pgsql: Back-patch "Refactor code in tablecmds.c to check and process ta

2024-09-24 Thread Noah Misch
Back-patch "Refactor code in tablecmds.c to check and process tablespace moves" Back-patch commits 4c9c359d38ff1e2de388eedd860785be6a49201c and 24843297a96d7be16cc3f4b090aacfc6e5e6839e to v13 and v12. Before those commits, we held the modifiable copy of the relation's pg_class row throughout a ta

pgsql: Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions.

2024-09-24 Thread Noah Misch
Warn if LOCKTAG_TUPLE is held at commit, under debug_assertions. The current use always releases this locktag. A planned use will continue that intent. It will involve more areas of code, making unlock omissions easier. Warn under debug_assertions, like we do for various resource leaks. Back-p

pgsql: Add further excludes to headerscheck

2024-09-24 Thread Peter Eisentraut
Add further excludes to headerscheck Some header files under contrib/isn/ are not meant to be included independently, and they fail -Wmissing-variable-declarations when doing so. Reported-by: Thomas Munro Discussion: https://www.postgresql.org/message-id/flat/CA%2BhUKG%2BYVt5MBD-w0HyHpsGb4U8RNg

Re: pgsql: Convert some extern variables to static

2024-09-24 Thread Peter Eisentraut
On 20.09.24 01:48, Thomas Munro wrote: On Fri, Sep 20, 2024 at 11:15 AM Tom Lane wrote: Peter Eisentraut writes: Convert some extern variables to static I'm surprised it took me so long to notice, but this commit makes headerscheck unhappy: Also discussed at: https://www.postgresql.org/m

pgsql: Tighten up make_libc_collator() and make_icu_collator().

2024-09-24 Thread Jeff Davis
Tighten up make_libc_collator() and make_icu_collator(). Ensure that error paths within these functions do not leak a collator, and return the result rather than using an out parameter. (Error paths in the caller may still result in a leaked collator, which will be addressed separately.) In make_

Re: pgsql: Allow meson builds to run test_pg_dump test in installcheck mode

2024-09-24 Thread Peter Geoghegan
On Mon, Sep 23, 2024 at 11:40 PM Michael Paquier wrote: > Allow meson builds to run test_pg_dump test in installcheck mode. This commit has Tom as the git author, and Michael as the git committer. Was that intentional? -- Peter Geoghegan

pgsql: Doc: Add the steps for upgrading the logical replication cluster

2024-09-24 Thread Amit Kapila
Doc: Add the steps for upgrading the logical replication cluster. Author: Vignesh C Reviewed-by: Peter Smith, Amit Kapila, Hayato Kuroda, Bharath Rupireddy Discussion: https://postgr.es/m/caldanm1_ido6srwzntqtr0zdvkk2whvhnkewavtgzbfsmub...@mail.gmail.com Branch -- master Details --- htt

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
vacuumdb: Skip temporary tables in query to build list of relations Running vacuumdb with a non-superuser while another user has created a temporary table would lead to a mid-flight permission failure, interrupting the operation. vacuum_rel() skips temporary relations of other backends, and it ma

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
vacuumdb: Skip temporary tables in query to build list of relations Running vacuumdb with a non-superuser while another user has created a temporary table would lead to a mid-flight permission failure, interrupting the operation. vacuum_rel() skips temporary relations of other backends, and it ma

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
vacuumdb: Skip temporary tables in query to build list of relations Running vacuumdb with a non-superuser while another user has created a temporary table would lead to a mid-flight permission failure, interrupting the operation. vacuum_rel() skips temporary relations of other backends, and it ma

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
vacuumdb: Skip temporary tables in query to build list of relations Running vacuumdb with a non-superuser while another user has created a temporary table would lead to a mid-flight permission failure, interrupting the operation. vacuum_rel() skips temporary relations of other backends, and it ma

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
vacuumdb: Skip temporary tables in query to build list of relations Running vacuumdb with a non-superuser while another user has created a temporary table would lead to a mid-flight permission failure, interrupting the operation. vacuum_rel() skips temporary relations of other backends, and it ma

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
vacuumdb: Skip temporary tables in query to build list of relations Running vacuumdb with a non-superuser while another user has created a temporary table would lead to a mid-flight permission failure, interrupting the operation. vacuum_rel() skips temporary relations of other backends, and it ma

pgsql: vacuumdb: Skip temporary tables in query to build list of relati

2024-09-24 Thread Michael Paquier
vacuumdb: Skip temporary tables in query to build list of relations Running vacuumdb with a non-superuser while another user has created a temporary table would lead to a mid-flight permission failure, interrupting the operation. vacuum_rel() skips temporary relations of other backends, and it ma