pgsql: Don't fail for > 1 walsenders in 019_replslot_limit, add debug m

2022-03-27 Thread Andres Freund
Don't fail for > 1 walsenders in 019_replslot_limit, add debug messages. So far the first of the retries introduced in f28bf667f60 resolves the issue. But I (Andres) am still suspicious that the start of the failures might indicate a problem. To reduce noise, stop reporting a failure if a retry r

pgsql: Mark pg_stat_get_subscription_stats() strict.

2022-03-27 Thread Andres Freund
Mark pg_stat_get_subscription_stats() strict. It accidentally was marked as non-strict. As it was introduced only in HEAD, we can just fix the catalog. Bumps catversion. Discussion: https://postgr.es/m/20220326212432.s5n2maw6kugnp...@alap3.anarazel.de Branch -- master Details --- http

pgsql: Fix NULL input behaviour of pg_stat_get_replication_slot().

2022-03-27 Thread Andres Freund
Fix NULL input behaviour of pg_stat_get_replication_slot(). pg_stat_get_replication_slot() accidentally was marked as non-strict, crashing when called with NULL input. As it's already released, introduce an explicit NULL check in 14, fix the catalog in HEAD. Bumps catversion in HEAD. Discussion:

pgsql: Fix NULL input behaviour of pg_stat_get_replication_slot().

2022-03-27 Thread Andres Freund
Fix NULL input behaviour of pg_stat_get_replication_slot(). pg_stat_get_replication_slot() accidentally was marked as non-strict, crashing when called with NULL input. As it's already released, introduce an explicit NULL check in 14, fix the catalog in HEAD. Bumps catversion in HEAD. Discussion:

pgsql: Fix pg_waldump docs.

2022-03-27 Thread Thomas Munro
Fix pg_waldump docs. Before 52b5568, the recently added -l option was short for --relation. We changed it to -R, but we forgot to update one place in the documentation. Author: Japin Li Discussion: https://postgr.es/m/MEYP282MB1669435CFBE57CBBA5116C66B61D9%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.C

pgsql: waldump: fix use-after-free in search_directory().

2022-03-27 Thread Andres Freund
waldump: fix use-after-free in search_directory(). After closedir() dirent->d_name is not valid anymore. As there alerady are a few places relying on the limited lifetime of pg_waldump, do so here as well, and just pg_strdup() the string. The bug was introduced in fc49e24fa69a. Found by UBSan, r

pgsql: waldump: fix use-after-free in search_directory().

2022-03-27 Thread Andres Freund
waldump: fix use-after-free in search_directory(). After closedir() dirent->d_name is not valid anymore. As there alerady are a few places relying on the limited lifetime of pg_waldump, do so here as well, and just pg_strdup() the string. The bug was introduced in fc49e24fa69a. Found by UBSan, r

pgsql: waldump: fix use-after-free in search_directory().

2022-03-27 Thread Andres Freund
waldump: fix use-after-free in search_directory(). After closedir() dirent->d_name is not valid anymore. As there alerady are a few places relying on the limited lifetime of pg_waldump, do so here as well, and just pg_strdup() the string. The bug was introduced in fc49e24fa69a. Found by UBSan, r

pgsql: waldump: fix use-after-free in search_directory().

2022-03-27 Thread Andres Freund
waldump: fix use-after-free in search_directory(). After closedir() dirent->d_name is not valid anymore. As there alerady are a few places relying on the limited lifetime of pg_waldump, do so here as well, and just pg_strdup() the string. The bug was introduced in fc49e24fa69a. Found by UBSan, r

pgsql: waldump: fix use-after-free in search_directory().

2022-03-27 Thread Andres Freund
waldump: fix use-after-free in search_directory(). After closedir() dirent->d_name is not valid anymore. As there alerady are a few places relying on the limited lifetime of pg_waldump, do so here as well, and just pg_strdup() the string. The bug was introduced in fc49e24fa69a. Found by UBSan, r

Re: pgsql: Fix up compiler warnings/errors from f4fb45d15.

2022-03-27 Thread Andrew Dunstan
On 3/27/22 18:32, Tom Lane wrote: > Fix up compiler warnings/errors from f4fb45d15. > > Per early buildfarm returns. > Thanks, I was just doing that. I'll keep an eye on it this evening. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com

pgsql: Fix up compiler warnings/errors from f4fb45d15.

2022-03-27 Thread Tom Lane
Fix up compiler warnings/errors from f4fb45d15. Per early buildfarm returns. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/cc7401d5ca498a84d9b47fd2e01cebd8e830e558 Modified Files -- src/backend/parser/parse_expr.c | 4 src/backend/utils/adt/rul

pgsql: SQL/JSON constructors

2022-03-27 Thread Andrew Dunstan
SQL/JSON constructors This patch introduces the SQL/JSON standard constructors for JSON: JSON() JSON_ARRAY() JSON_ARRAYAGG() JSON_OBJECT() JSON_OBJECTAGG() For the most part these functions provide facilities that mimic existing json/jsonb functions. However, they also offer some useful addition

pgsql: Common SQL/JSON clauses

2022-03-27 Thread Andrew Dunstan
Common SQL/JSON clauses This introduces some of the building blocks used by the SQL/JSON constructor and query functions. Specifically, it provides node executor and grammar support for the FORMAT JSON [ENCODING foo] clause, and values decorated with it, and for the RETURNING clause. The followin

pgsql: Remove more unused module imports from TAP tests

2022-03-27 Thread Daniel Gustafsson
Remove more unused module imports from TAP tests This is a follow-up to commit 7dac61402 which removed a set of unused modules from the TAP test. The Config references in the pg_ctl and pg_rewind tests were removed in commit 1c6d46293. Fcntl ':mode' and File::stat in the pg_ctl test were added i

pgsql: Remove useless variable.

2022-03-27 Thread Tom Lane
Remove useless variable. flatten_join_alias_vars_mutator counted attnums, but didn't do anything with the count (no doubt it did at one time). Noted by buildfarm member seawasp. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c2d81ee902b96e6218e832eea184dbbfbc3af7d

pgsql: Avoid using large pass-by-value struct arguments in pgbench.

2022-03-27 Thread Tom Lane
Avoid using large pass-by-value struct arguments in pgbench. In the wake of commit 4a39f87ac, which noticeably increased the size of struct StatsData and thereby ParsedScript, Coverity started to complain that ParsedScript was unreasonably large to be passing by value. The two places that do this

pgsql: Fix breakage of get_ps_display() in the PS_USE_NONE case.

2022-03-27 Thread Tom Lane
Fix breakage of get_ps_display() in the PS_USE_NONE case. Commit 8c6d30f21 caused this function to fail to set *displen in the PS_USE_NONE code path. If the variable's previous value had been negative, that'd lead to a memory clobber at some call sites. We'd managed not to notice due to very thi

pgsql: Fix breakage of get_ps_display() in the PS_USE_NONE case.

2022-03-27 Thread Tom Lane
Fix breakage of get_ps_display() in the PS_USE_NONE case. Commit 8c6d30f21 caused this function to fail to set *displen in the PS_USE_NONE code path. If the variable's previous value had been negative, that'd lead to a memory clobber at some call sites. We'd managed not to notice due to very thi

pgsql: Fix breakage of get_ps_display() in the PS_USE_NONE case.

2022-03-27 Thread Tom Lane
Fix breakage of get_ps_display() in the PS_USE_NONE case. Commit 8c6d30f21 caused this function to fail to set *displen in the PS_USE_NONE code path. If the variable's previous value had been negative, that'd lead to a memory clobber at some call sites. We'd managed not to notice due to very thi

pgsql: Fix comment in execParallel.c

2022-03-27 Thread Michael Paquier
Fix comment in execParallel.c 0f61727 has made this comment incorrect. Author: Julien Rouhaud Reviewed-by: Matthias van de Meent Discussion: https://postgr.es/m/20220326160117.qtp5nkuku6cvhcby@jrouhaud Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/411b91360f2711e

pgsql: pageinspect: Add more sanity checks to prevent out-of-bound read

2022-03-27 Thread Michael Paquier
pageinspect: Add more sanity checks to prevent out-of-bound reads A couple of code paths use the special area on the page passed by the function caller, expecting to find some data in it. However, feeding an incorrect page can lead to out-of-bound reads when trying to access the page special area

pgsql: pageinspect: Add more sanity checks to prevent out-of-bound read

2022-03-27 Thread Michael Paquier
pageinspect: Add more sanity checks to prevent out-of-bound reads A couple of code paths use the special area on the page passed by the function caller, expecting to find some data in it. However, feeding an incorrect page can lead to out-of-bound reads when trying to access the page special area

pgsql: pageinspect: Add more sanity checks to prevent out-of-bound read

2022-03-27 Thread Michael Paquier
pageinspect: Add more sanity checks to prevent out-of-bound reads A couple of code paths use the special area on the page passed by the function caller, expecting to find some data in it. However, feeding an incorrect page can lead to out-of-bound reads when trying to access the page special area

pgsql: pageinspect: Add more sanity checks to prevent out-of-bound read

2022-03-27 Thread Michael Paquier
pageinspect: Add more sanity checks to prevent out-of-bound reads A couple of code paths use the special area on the page passed by the function caller, expecting to find some data in it. However, feeding an incorrect page can lead to out-of-bound reads when trying to access the page special area

pgsql: pageinspect: Add more sanity checks to prevent out-of-bound read

2022-03-27 Thread Michael Paquier
pageinspect: Add more sanity checks to prevent out-of-bound reads A couple of code paths use the special area on the page passed by the function caller, expecting to find some data in it. However, feeding an incorrect page can lead to out-of-bound reads when trying to access the page special area

pgsql: pageinspect: Add more sanity checks to prevent out-of-bound read

2022-03-27 Thread Michael Paquier
pageinspect: Add more sanity checks to prevent out-of-bound reads A couple of code paths use the special area on the page passed by the function caller, expecting to find some data in it. However, feeding an incorrect page can lead to out-of-bound reads when trying to access the page special area