pgsql: Update snowball

2021-12-06 Thread Peter Eisentraut
Update snowball Update to snowball tag v2.2.0. Minor changes only. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bba962f0c052bfab79df79ac5629eac5eab5b842 Modified Files -- src/backend/snowball/README|4 +- .../snowball/libs

pgsql: Postpone calls of unsafe server-side functions in pg_dump.

2021-12-06 Thread Tom Lane
Postpone calls of unsafe server-side functions in pg_dump. Avoid calling pg_get_partkeydef(), pg_get_expr(relpartbound), and regtypeout until we have lock on the relevant tables. The existing coding is at serious risk of failure if there are any concurrent DROP TABLE commands going on --- includin

pgsql: Account for TOAST data while scheduling parallel dumps.

2021-12-06 Thread Tom Lane
Account for TOAST data while scheduling parallel dumps. In parallel mode, pg_dump tries to order the table-data-dumping jobs with the largest tables first. However, it was only consulting the pg_class.relpages value to determine table size. This ignores TOAST data, and so we could make poor sched

pgsql: Rethink pg_dump's handling of object ACLs.

2021-12-06 Thread Tom Lane
Rethink pg_dump's handling of object ACLs. Throw away most of the existing logic for this, as it was very inefficient thanks to expensive sub-selects executed to collect ACL data that we very possibly would have no interest in dumping. Reduce the ACL handling in the initial per-object-type queries

pgsql: Avoid per-object queries in performance-critical paths in pg_dum

2021-12-06 Thread Tom Lane
Avoid per-object queries in performance-critical paths in pg_dump. Instead of issuing a secondary data-collection query against each table to be dumped, issue just one query, with a WHERE clause restricting it to be applied to only the tables we intend to dump. Likewise for indexes, constraints, a

pgsql: Use PREPARE/EXECUTE for repetitive per-object queries in pg_dump

2021-12-06 Thread Tom Lane
Use PREPARE/EXECUTE for repetitive per-object queries in pg_dump. For objects such as functions, pg_dump issues the same secondary data-collection query against each object to be dumped. This can't readily be refactored to avoid the repetitive queries, but we can PREPARE these queries to reduce p

pgsql: Refactor pg_dump's tracking of object components to be dumped.

2021-12-06 Thread Tom Lane
Refactor pg_dump's tracking of object components to be dumped. Split the DumpableObject.dump bitmask field into separate bitmasks tracking which components are requested to be dumped (in the existing "dump" field) and which components exist for the particular object (in the new "components" field)

pgsql: Fix inappropriate uses of PG_GETARG_UINT32()

2021-12-06 Thread Peter Eisentraut
Fix inappropriate uses of PG_GETARG_UINT32() The chr() function used PG_GETARG_UINT32() even though the argument is declared as (signed) integer. As a result, you can pass negative arguments to this function and it internally interprets them as positive. Ultimately ends up being harmless, but it