pgsql: Pass constructName to transformJsonValueExpr()

2023-07-20 Thread Amit Langote
Pass constructName to transformJsonValueExpr() This allows it to pass to coerce_to_specific_type() the actual name corresponding to the specific JSON_* function expression being transformed, instead of the currently hardcoded string. Backpatched to 16 from the development branch to keep the code

pgsql: Unify JSON categorize type API and export for external use

2023-07-20 Thread Amit Langote
Unify JSON categorize type API and export for external use This essentially removes the JsonbTypeCategory enum and jsonb_categorize_type() and integrates any jsonb-specific logic that was in jsonb_categorize_type() into json_categorize_type(), now moved to jsonfuncs.c. The remaining JsonTypeCateg

pgsql: pg_upgrade: include additional detail in cluster check

2023-07-20 Thread Daniel Gustafsson
pg_upgrade: include additional detail in cluster check When the cluster failed the pg_controldata check for clean shut down we only reported that it did so, not why. The state of the cluster can be important information when diagnosing the failed upgrade attempt, so instead include it in the error

pgsql: Set fixed dates for test certificates validity

2023-07-20 Thread Daniel Gustafsson
Set fixed dates for test certificates validity Rather than specifying a validity of 10 000 days into the future during test certificate generation, this hardcodes the notBefore and notAfter attributes to known values. This will allow writing tests on the validity of the certificates without knowin

pgsql: Add notBefore and notAfter to SSL cert info display

2023-07-20 Thread Daniel Gustafsson
Add notBefore and notAfter to SSL cert info display This adds the X509 attributes notBefore and notAfter to sslinfo as well as pg_stat_ssl to allow verifying and identifying the validity period of the current client certificate. Author: Cary Huang Discussion: https://postgr.es/m/182b8565486.10a

pgsql: Revert "Add notBefore and notAfter to SSL cert info display"

2023-07-20 Thread Daniel Gustafsson
Revert "Add notBefore and notAfter to SSL cert info display" Due to an oversight in reviewing, this used functionality not compatible with old versions of OpenSSL. This reverts commit 75ec5e7bec700577d39d653c316e3ae6c505842c. Branch -- master Details --- https://git.postgresql.org/pg/co

pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().

2023-07-20 Thread Tom Lane
Guard against null plan pointer in CachedPlanIsSimplyValid(). If both the passed-in plan pointer and plansource->gplan are NULL, CachedPlanIsSimplyValid would think that the plan pointer is possibly-valid and try to dereference it. For the one extant call site in plpgsql, this situation doesn't n

pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().

2023-07-20 Thread Tom Lane
Guard against null plan pointer in CachedPlanIsSimplyValid(). If both the passed-in plan pointer and plansource->gplan are NULL, CachedPlanIsSimplyValid would think that the plan pointer is possibly-valid and try to dereference it. For the one extant call site in plpgsql, this situation doesn't n

pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().

2023-07-20 Thread Tom Lane
Guard against null plan pointer in CachedPlanIsSimplyValid(). If both the passed-in plan pointer and plansource->gplan are NULL, CachedPlanIsSimplyValid would think that the plan pointer is possibly-valid and try to dereference it. For the one extant call site in plpgsql, this situation doesn't n

pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().

2023-07-20 Thread Tom Lane
Guard against null plan pointer in CachedPlanIsSimplyValid(). If both the passed-in plan pointer and plansource->gplan are NULL, CachedPlanIsSimplyValid would think that the plan pointer is possibly-valid and try to dereference it. For the one extant call site in plpgsql, this situation doesn't n

pgsql: Guard against null plan pointer in CachedPlanIsSimplyValid().

2023-07-20 Thread Tom Lane
Guard against null plan pointer in CachedPlanIsSimplyValid(). If both the passed-in plan pointer and plansource->gplan are NULL, CachedPlanIsSimplyValid would think that the plan pointer is possibly-valid and try to dereference it. For the one extant call site in plpgsql, this situation doesn't n

pgsql: Fix worker_spi when launching workers without shared_preload_lib

2023-07-20 Thread Michael Paquier
Fix worker_spi when launching workers without shared_preload_libraries Currently, the database name to connect is initialized only when the module is loaded with shared_preload_libraries, causing any call of worker_spi_launch() to fail if the library is not loaded for a dynamic bgworker launch. R