pgsql: Refactor some code related to backend statistics

2025-01-09 Thread Michael Paquier
Refactor some code related to backend statistics This commit changes the way pending backend statistics are tracked by moving them into a new structure called PgStat_BackendPending, removing PgStat_BackendPendingIO. PgStat_BackendPending currently only includes PgStat_PendingIO for the pending I/

pgsql: Fix UNION planner datatype issue

2025-01-09 Thread David Rowley
Fix UNION planner datatype issue 66c0185a3 gave the planner the ability to have union child queries provide the union planner with pre-sorted input so that UNION queries could be more efficiently implemented using Merge Append. That commit overlooked checking that the UNION target list and the un

pgsql: Fix UNION planner datatype issue

2025-01-09 Thread David Rowley
Fix UNION planner datatype issue 66c0185a3 gave the planner the ability to have union child queries provide the union planner with pre-sorted input so that UNION queries could be more efficiently implemented using Merge Append. That commit overlooked checking that the UNION target list and the un

pgsql: Merge pgstat_count_io_op_n() and pgstat_count_io_op()

2025-01-09 Thread Michael Paquier
Merge pgstat_count_io_op_n() and pgstat_count_io_op() The pgstat_count_io_op() function, which counts a single I/O operation, wraps pgstat_count_io_op_n() with a counter value of 1. The latter is declared in pgstat.h and used nowhere in the code, so let's remove it in favor of the former. This c

pgsql: Fix an ALTER GROUP ... DROP USER error message.

2025-01-09 Thread Nathan Bossart
Fix an ALTER GROUP ... DROP USER error message. This error message stated the privileges required to add a member to a group even if the user was trying to drop a member: postgres=> alter group a drop user b; ERROR: permission denied to alter role DETAIL: Only roles with

pgsql: Fix an ALTER GROUP ... DROP USER error message.

2025-01-09 Thread Nathan Bossart
Fix an ALTER GROUP ... DROP USER error message. This error message stated the privileges required to add a member to a group even if the user was trying to drop a member: postgres=> alter group a drop user b; ERROR: permission denied to alter role DETAIL: Only roles with

pgsql: Fix an ALTER GROUP ... DROP USER error message.

2025-01-09 Thread Nathan Bossart
Fix an ALTER GROUP ... DROP USER error message. This error message stated the privileges required to add a member to a group even if the user was trying to drop a member: postgres=> alter group a drop user b; ERROR: permission denied to alter role DETAIL: Only roles with

pgsql: Simplify signature of RewriteTable

2025-01-09 Thread Álvaro Herrera
Simplify signature of RewriteTable This function doesn't need the lockmode to be passed: it was being used to lock the new heap, but that's bogus, because the only caller has already obtained the appropriate lock on the new heap (which is unimportant anyway, because the relation's creation is not

pgsql: doc: Clarify synchronous_standby_names parameter.

2025-01-09 Thread Fujii Masao
doc: Clarify synchronous_standby_names parameter. The synchronous_standby_names GUC allows specifying num_sync, the number of synchronous standbys transactions must wait for replies from. This value must be an integer greater than zero. This commit updates the documentation to clarify this require

pgsql: Use @extschema:name@ notation in contrib transform modules.

2025-01-09 Thread Tom Lane
Use @extschema:name@ notation in contrib transform modules. Harden hstore_plperl, hstore_plpython, and ltree_plpython against search-path-based attacks by using @extschema:name@ notation to refer to the underlying hstore or ltree data type. This allows removal of the previous documentation warnin