pgsql: Use atomics to avoid locking in InjectionPointRun()

2024-07-15 Thread Heikki Linnakangas
Use atomics to avoid locking in InjectionPointRun() This allows using injection points without having a PGPROC, like early at backend startup, or in the postmaster. The injection points facility is new in v17, so backpatch there. Reviewed-by: Michael Paquier Disussion: https://www.postgresql.o

pgsql: Use atomics to avoid locking in InjectionPointRun()

2024-07-15 Thread Heikki Linnakangas
Use atomics to avoid locking in InjectionPointRun() This allows using injection points without having a PGPROC, like early at backend startup, or in the postmaster. The injection points facility is new in v17, so backpatch there. Reviewed-by: Michael Paquier Disussion: https://www.postgresql.o

pgsql: Use correct type for pq_mq_parallel_leader_proc_number variable

2024-07-15 Thread Heikki Linnakangas
Use correct type for pq_mq_parallel_leader_proc_number variable It's a ProcNumber, not a process id. Both are integers, so it's harmless, but clearly wrong. It's been wrong since forever, the mistake has survived through a couple of refactorings already. Spotted-by: Thomas Munro Discussion: http

Re: pgsql: Replace BackendIds with 0-based ProcNumbers

2024-07-15 Thread Heikki Linnakangas
On 09/07/2024 21:10, Thomas Munro wrote: --- a/src/backend/libpq/pqmq.c +++ b/src/backend/libpq/pqmq.c @@ -26,7 +26,7 @@ static shm_mq_handle *pq_mq_handle; static bool pq_mq_busy = false; static pid_t pq_mq_parallel_leader_pid = 0; -static pid_t pq_mq_parallel_leader_backend_id = InvalidBa

pgsql: Run LLVM verify pass on IR in assert builds.

2024-07-15 Thread Thomas Munro
Run LLVM verify pass on IR in assert builds. The problem fixed by commit 53c8d6c9 would have been noticed if we'd been running LLVM's verify pass on generated IR. Doing so also reveals a complaint about incorrect name mangling, fixed here. Only enabled for LLVM 17+ because it uses the new pass m

pgsql: Doc: minor improvements for plpgsql "Transaction Management" sec

2024-07-15 Thread Tom Lane
Doc: minor improvements for plpgsql "Transaction Management" section. Point out that savepoint commands cannot be issued in PL/pgSQL, and suggest that exception blocks can usually be used instead. Add a caveat to the discussion of cursor loops vs. transactions, pointing out that any locks taken b

pgsql: Doc: minor improvements for plpgsql "Transaction Management" sec

2024-07-15 Thread Tom Lane
Doc: minor improvements for plpgsql "Transaction Management" section. Point out that savepoint commands cannot be issued in PL/pgSQL, and suggest that exception blocks can usually be used instead. Add a caveat to the discussion of cursor loops vs. transactions, pointing out that any locks taken b

pgsql: Fix type confusion in guc_var_compare()

2024-07-15 Thread Andres Freund
Fix type confusion in guc_var_compare() Before this change guc_var_compare() cast the input arguments to const struct config_generic *. That's not quite right however, as the input on one side is often just a char * on one side. Instead just use char *, the first field in config_generic. This f

pgsql: Fix type confusion in guc_var_compare()

2024-07-15 Thread Andres Freund
Fix type confusion in guc_var_compare() Before this change guc_var_compare() cast the input arguments to const struct config_generic *. That's not quite right however, as the input on one side is often just a char * on one side. Instead just use char *, the first field in config_generic. This f

pgsql: Fix type confusion in guc_var_compare()

2024-07-15 Thread Andres Freund
Fix type confusion in guc_var_compare() Before this change guc_var_compare() cast the input arguments to const struct config_generic *. That's not quite right however, as the input on one side is often just a char * on one side. Instead just use char *, the first field in config_generic. This f

pgsql: Fix type confusion in guc_var_compare()

2024-07-15 Thread Andres Freund
Fix type confusion in guc_var_compare() Before this change guc_var_compare() cast the input arguments to const struct config_generic *. That's not quite right however, as the input on one side is often just a char * on one side. Instead just use char *, the first field in config_generic. This f

pgsql: Fix type confusion in guc_var_compare()

2024-07-15 Thread Andres Freund
Fix type confusion in guc_var_compare() Before this change guc_var_compare() cast the input arguments to const struct config_generic *. That's not quite right however, as the input on one side is often just a char * on one side. Instead just use char *, the first field in config_generic. This f

pgsql: Fix type confusion in guc_var_compare()

2024-07-15 Thread Andres Freund
Fix type confusion in guc_var_compare() Before this change guc_var_compare() cast the input arguments to const struct config_generic *. That's not quite right however, as the input on one side is often just a char * on one side. Instead just use char *, the first field in config_generic. This f

pgsql: ci: Upgrade to Debian Bookworm

2024-07-15 Thread Andres Freund
ci: Upgrade to Debian Bookworm Bullseye is getting long in the tooth, upgrade to the current stable version. Backpatch to all versions with CI support, we don't want to generate CI images for multiple Debian versions. Author: Nazir Bilal Yavuz Discussion: https://postgr.es/m/CAN55FZ0fY5EFHXLKC

pgsql: ci: Upgrade to Debian Bookworm

2024-07-15 Thread Andres Freund
ci: Upgrade to Debian Bookworm Bullseye is getting long in the tooth, upgrade to the current stable version. Backpatch to all versions with CI support, we don't want to generate CI images for multiple Debian versions. Author: Nazir Bilal Yavuz Discussion: https://postgr.es/m/CAN55FZ0fY5EFHXLKC

pgsql: ci: Upgrade to Debian Bookworm

2024-07-15 Thread Andres Freund
ci: Upgrade to Debian Bookworm Bullseye is getting long in the tooth, upgrade to the current stable version. Backpatch to all versions with CI support, we don't want to generate CI images for multiple Debian versions. Author: Nazir Bilal Yavuz Discussion: https://postgr.es/m/CAN55FZ0fY5EFHXLKC

pgsql: Fix type confusion in guc_var_compare()

2024-07-15 Thread Andres Freund
Fix type confusion in guc_var_compare() Before this change guc_var_compare() cast the input arguments to const struct config_generic *. That's not quite right however, as the input on one side is often just a char * on one side. Instead just use char *, the first field in config_generic. This f

pgsql: ci: Upgrade to Debian Bookworm

2024-07-15 Thread Andres Freund
ci: Upgrade to Debian Bookworm Bullseye is getting long in the tooth, upgrade to the current stable version. Backpatch to all versions with CI support, we don't want to generate CI images for multiple Debian versions. Author: Nazir Bilal Yavuz Discussion: https://postgr.es/m/CAN55FZ0fY5EFHXLKC

pgsql: Add missing RestrictSearchPath() calls.

2024-07-15 Thread Jeff Davis
Add missing RestrictSearchPath() calls. Reported-by: Noah Misch Backpatch-through: 17 Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8e28778ce396c3dac74a5fa8724e1ca7cea16d19 Modified Files ---

pgsql: Add missing RestrictSearchPath() calls.

2024-07-15 Thread Jeff Davis
Add missing RestrictSearchPath() calls. Reported-by: Noah Misch Backpatch-through: 17 Discussion: https://postgr.es/m/[email protected] Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a15b0edb5dd9d2a3731f374b576485799c00431c Modified Files

pgsql: ci: Use newer LLVM version with gcc, to avoid compiler warnings

2024-07-15 Thread Andres Freund
ci: Use newer LLVM version with gcc, to avoid compiler warnings gcc emits a warning for LLVM 14 code outside of our control. To avoid that, update to a newer LLVM version. Do so both in the CompilerWarnings and normal tasks - the latter don't fail, but the warnings make it more likely that we'd mi

pgsql: Fix bad indentation introduced in 43cd30bcd1c

2024-07-15 Thread Andres Freund
Fix bad indentation introduced in 43cd30bcd1c Oops. Reported-by: Nathan Bossart Discussion: https://postgr.es/m/ZpVZB9rH5tHllO75@nathan Backpatch: 12-, like 43cd30bcd1c Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/ff3cae4875d3391c591ac5d22693f27f056e62d2

pgsql: Fix bad indentation introduced in 43cd30bcd1c

2024-07-15 Thread Andres Freund
Fix bad indentation introduced in 43cd30bcd1c Oops. Reported-by: Nathan Bossart Discussion: https://postgr.es/m/ZpVZB9rH5tHllO75@nathan Backpatch: 12-, like 43cd30bcd1c Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/47ecbfdfcc71e41d7dcc35f0be04f8adbe88397f Modif

pgsql: Fix bad indentation introduced in 43cd30bcd1c

2024-07-15 Thread Andres Freund
Fix bad indentation introduced in 43cd30bcd1c Oops. Reported-by: Nathan Bossart Discussion: https://postgr.es/m/ZpVZB9rH5tHllO75@nathan Backpatch: 12-, like 43cd30bcd1c Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/3006fd8e6ececbb5662135da77a61af311edf81e

pgsql: Fix bad indentation introduced in 43cd30bcd1c

2024-07-15 Thread Andres Freund
Fix bad indentation introduced in 43cd30bcd1c Oops. Reported-by: Nathan Bossart Discussion: https://postgr.es/m/ZpVZB9rH5tHllO75@nathan Backpatch: 12-, like 43cd30bcd1c Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/11441ad48d09740efd99edb654534cc4662b6ecc

pgsql: Fix bad indentation introduced in 43cd30bcd1c

2024-07-15 Thread Andres Freund
Fix bad indentation introduced in 43cd30bcd1c Oops. Reported-by: Nathan Bossart Discussion: https://postgr.es/m/ZpVZB9rH5tHllO75@nathan Backpatch: 12-, like 43cd30bcd1c Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/212b0262d60e921d97f1b824734d2c607e49fa6d

pgsql: Fix bad indentation introduced in 43cd30bcd1c

2024-07-15 Thread Andres Freund
Fix bad indentation introduced in 43cd30bcd1c Oops. Reported-by: Nathan Bossart Discussion: https://postgr.es/m/ZpVZB9rH5tHllO75@nathan Backpatch: 12-, like 43cd30bcd1c Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/9d3a2b3cdfbd1d6edbc828feecf979cb35d74091

pgsql: Fix bad indentation introduced in 43cd30bcd1c

2024-07-15 Thread Andres Freund
Fix bad indentation introduced in 43cd30bcd1c Oops. Reported-by: Nathan Bossart Discussion: https://postgr.es/m/ZpVZB9rH5tHllO75@nathan Backpatch: 12-, like 43cd30bcd1c Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/69bdee12e4437d3681de584de8ecced1fda4bcb5

pgsql: Add tap test for pg_signal_autovacuum role

2024-07-15 Thread Michael Paquier
Add tap test for pg_signal_autovacuum role This commit provides testig coverage for ccd38024bc3c, checking that a role granted pg_signal_autovacuum_worker is able to stop a vacuum worker. An injection point with a wait is placed at the beginning of autovacuum worker startup to make sure that a wo

pgsql: SQL/JSON: Fix a paragraph in JSON_TABLE documentation

2024-07-15 Thread Amit Langote
SQL/JSON: Fix a paragraph in JSON_TABLE documentation Using text inside parantheses is not a common or good style, so rephrase a sentence to avoid that style. Also rephrase the text in that paragraph a bit while at it. Reported-by: Marcos Pegoraro Author: Jian He Reviewed-by: Daniel Gustafsson

pgsql: SQL/JSON: Fix a paragraph in JSON_TABLE documentation

2024-07-15 Thread Amit Langote
SQL/JSON: Fix a paragraph in JSON_TABLE documentation Using text inside parantheses is not a common or good style, so rephrase a sentence to avoid that style. Also rephrase the text in that paragraph a bit while at it. Reported-by: Marcos Pegoraro Author: Jian He Reviewed-by: Daniel Gustafsson