pgsql: postgres_fdw: Add function to list cached connections to foreign

2021-01-17 Thread Fujii Masao
postgres_fdw: Add function to list cached connections to foreign servers. This commit adds function postgres_fdw_get_connections() to return the foreign server names of all the open connections that postgres_fdw established from the local session to the foreign servers. This function also returns

pgsql: Refactor option handling of CLUSTER, REINDEX and VACUUM

2021-01-17 Thread Michael Paquier
Refactor option handling of CLUSTER, REINDEX and VACUUM This continues the work done in b5913f6. All the options of those commands are changed to use hex values rather than enums to reduce the risk of compatibility bugs when introducing new options. Each option set is moved into a new structure

pgsql: pageinspect: Fix relcache leak in gist_page_items().

2021-01-17 Thread Heikki Linnakangas
pageinspect: Fix relcache leak in gist_page_items(). The gist_page_items() function opened the index relation on first call and closed it on the last call. But there's no guarantee that the function is run to completion, leading to a relcache leak and warning at the end of the transaction. To fix,

pgsql: Set PD_ALL_VISIBLE and visibility map bits in COPY FREEZE

2021-01-17 Thread Tomas Vondra
Set PD_ALL_VISIBLE and visibility map bits in COPY FREEZE Make sure COPY FREEZE marks the pages as PD_ALL_VISIBLE and updates the visibility map. Until now we only marked individual tuples as frozen, but page-level flags were not updated, so the first VACUUM after the COPY FREEZE had to rewrite th

pgsql: Add missing array-enlargement logic to test_regex.c.

2021-01-17 Thread Tom Lane
Add missing array-enlargement logic to test_regex.c. The stanza to report a "partial" match could overrun the initially allocated output array, so it needs its own copy of the array-resizing logic that's in the main loop. I overlooked the need for this in ca8217c10. Per report from Alexander Lak

pgsql: Add documentation chapter about checksums

2021-01-17 Thread Magnus Hagander
Add documentation chapter about checksums Data checksums did not have a longer discussion in the docs, this adds a short section with an overview. Extracted from the larger patch for on-line enabling of checksums, which has many more authors and reviewers. Author: Daniel Gustafsson Reviewed-By:

pgsql: Revert "psql \dX: list extended statistics objects"

2021-01-17 Thread Tomas Vondra
Revert "psql \dX: list extended statistics objects" Reverts 891a1d0bca, because the new psql command \dX only worked for users users who can read pg_statistic_ext_data catalog, and most regular users lack that privilege (the catalog may contain sensitive user data). Reported-by: Noriyoshi Shinod

pgsql: Add --no-instructions parameter to initdb

2021-01-17 Thread Magnus Hagander
Add --no-instructions parameter to initdb Specifying this parameter removes the informational messages about how to start the server. This is intended for use by wrappers in different packaging systems, where those instructions would most likely be wrong anyway, but the other output from initdb wo

pgsql: Add pg_stat_database counters for sessions and session time

2021-01-17 Thread Magnus Hagander
Add pg_stat_database counters for sessions and session time This add counters for number of sessions, the different kind of session termination types, and timers for how much time is spent in active vs idle in a database to pg_stat_database. Internally this also renames the parameter "force" to d