pgsql: Use multi-inserts for pg_ts_config_map

2022-11-15 Thread Michael Paquier
Use multi-inserts for pg_ts_config_map Two locations working on pg_ts_config_map are switched from CatalogTupleInsert() to a multi-insert approach with tuple slots: - ALTER TEXT SEARCH CONFIGURATION ADD/ALTER MAPPING when inserting new entries. The number of entries to insert is known in advance,

pgsql: Fix test in ae168c794f, per buildfarm.

2022-11-15 Thread Jeff Davis
Fix test in ae168c794f, per buildfarm. Reported-by: Michael Paquier Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/36e0358e70498b5bf5e3e83d91ac964fc24c249e Modified Files -- src/test/modules/

pgsql: Use multi-inserts for pg_enum

2022-11-15 Thread Michael Paquier
Use multi-inserts for pg_enum This allows to insert at once all the enum values defined with a given type into pg_enum, reducing the WAL produced by roughly 10%~. pg_enum's indexes are opened and closed now once rather than N times. The number of items to insert is known in advance, making this

pgsql: Avoid some overhead with open and close of catalog indexes

2022-11-15 Thread Michael Paquier
Avoid some overhead with open and close of catalog indexes This commit improves two code paths to open and close indexes a minimum amount of times when doing a series of catalog updates or inserts. CatalogTupleInsert() is costly when using it for multiple inserts or updates compared to CatalogTup

pgsql: Add test module for SLRUs

2022-11-15 Thread Michael Paquier
Add test module for SLRUs This commit introduces a basic facility to test SLRUs, in terms of initialization, page reads, writes, flushes, truncation and deletions, using SQL wrappers around the APIs of slru.c. This should be easily extensible at will, and it can be used as a starting point for so

pgsql: Mark argument of RegisterCustomRmgr() as const.

2022-11-15 Thread Jeff Davis
Mark argument of RegisterCustomRmgr() as const. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/1eda3ce80287f985f8165640d4bf663fe4649b41 Modified Files -- doc/src/sgml/custom-rmgr.sgml | 2 +- src/backend/access/transam/rmgr.c

pgsql: Add test module for Custom WAL Resource Manager feature.

2022-11-15 Thread Jeff Davis
Add test module for Custom WAL Resource Manager feature. Author: Bharath Rupireddy, Jeff Davis Discussion: https://postgr.es/m/CALj2ACVTBNA1wfVCsikfhygAbZe6kFY8Oz6PhOyhHyA4vAGouA%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ae168c794f09984d8fe44

pgsql: Deduplicate freeze plans in freeze WAL records.

2022-11-15 Thread Peter Geoghegan
Deduplicate freeze plans in freeze WAL records. Make heapam WAL records that describe freezing performed by VACUUM more space efficient by storing each distinct "freeze plan" once, alongside an array of associated page offset numbers (one per freeze plan). The freeze plans required for most heap

pgsql: Check return value of pclose() correctly

2022-11-15 Thread Peter Eisentraut
Check return value of pclose() correctly Some callers didn't check the return value of pclose() or ClosePipeStream() correctly. Either they didn't check it at all or they treated it like the return of fclose(). The correct way is to first check whether the return value is -1, and then report err

pgsql: doc: Use more concise wording for pl/pgSQL TG_ variables

2022-11-15 Thread Daniel Gustafsson
doc: Use more concise wording for pl/pgSQL TG_ variables To improve readability of the TG_ variables definition lists, this moves the datatypes up to the defined term to avoid having each entry start with "Data type". This also removes redundant wording that that didn't carry any information from

pgsql: psql: Add command to use extended query protocol

2022-11-15 Thread Peter Eisentraut
psql: Add command to use extended query protocol This adds a new psql command \bind that sets query parameters and causes the next query to be sent using the extended query protocol. Example: SELECT $1, $2 \bind 'foo' 'bar' \g This may be useful for psql scripting, but one of the main purpos

pgsql: libpq error message refactoring, part 2

2022-11-15 Thread Peter Eisentraut
libpq error message refactoring, part 2 This applies the new APIs to the code. Reviewed-by: Alvaro Herrera Discussion: https://www.postgresql.org/message-id/flat/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: libpq error message refactoring

2022-11-15 Thread Peter Eisentraut
libpq error message refactoring libpq now contains a mix of error message strings that end with newlines and don't end with newlines, due to some newer code paths with new ways of passing errors around. This leads to confusion and mistakes both during development and translation. This adds new f

pgsql: Disallow setting archive_library and archive_command at the same

2022-11-15 Thread Peter Eisentraut
Disallow setting archive_library and archive_command at the same time Setting archive_library and archive_command at the same time is now an error. Before, archive_library would take precedence over archive_command. Author: Nathan Bossart Reviewed-by: Peter Eisentraut Reviewed-by: Bharath Rupi