pgsql: postgres_fdw: Minor cleanup for pgfdw_abort_cleanup().

2022-03-24 Thread Etsuro Fujita
postgres_fdw: Minor cleanup for pgfdw_abort_cleanup(). Commit 85c696112 introduced this function to deduplicate code in the transaction callback functions, but the SQL command passed as an argument to it was useless when it returned before aborting a remote transaction using the command. Modify p

pgsql: Fix typos in standby.c

2022-03-24 Thread Michael Paquier
Fix typos in standby.c xl_running_xacts exists, not xl_xact_running_xacts. Author: Hou Zhijie Discussion: https://postgr.es/m/os0pr01mb57160d8b01097ffb5c17506594...@os0pr01mb5716.jpnprd01.prod.outlook.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ad8759bea06

pgsql: Remove some useless free calls.

2022-03-24 Thread Amit Kapila
Remove some useless free calls. These were introduced in recent commit 52e4f0cd47. We were trying to free some transient space consumption and that too was not entirely correct and complete. We don't need this partial freeing of memory as it will be allocated just once for a query and will be free

pgsql: Second attempt to fix pgbench TAP test.

2022-03-24 Thread Tatsuo Ishii
Second attempt to fix pgbench TAP test. Bildfarm member prairiedog reported a pgbench TAP test failure after commit: 4a39f87acd6e681e5ded1239391d8a92645b43d6. This is the second attempt to fix it. It seems older version of Perl does not accept "\gN". Replace it with plain old "\N" because actually

pgsql: Improve command line options for pg_waldump.

2022-03-24 Thread Thomas Munro
Improve command line options for pg_waldump. Follow-up improvements for commit 127aea2a based on discussion: * use fork name for --fork, not number * use -R, -B as short switches for --relation, --block * re-alphabetize the list of switches (code, --help and docs) Suggested-by: Peter Eisentraut

pgsql: Add retries for further investigation of 019_replslot_limit.pl f

2022-03-24 Thread Andres Freund
Add retries for further investigation of 019_replslot_limit.pl failures. Tom noticed evidence in the buildfarm suggesting the failures might just be really slow process exits. To investigate further, instead of giving up after seeing multiple walsender pids once, retry. For now continue to report

pgsql: List offending databases in pg_upgrade datallowconn check

2022-03-24 Thread Daniel Gustafsson
List offending databases in pg_upgrade datallowconn check The check for datallowconn being properly set on all databases in the old cluster errored out on the first instance, rather than report the set of problematic databases. This adds reporting to a textfile like how many other checks are perf

pgsql: Fix pg_statio_all_tables view for multiple TOAST indexes.

2022-03-24 Thread Tom Lane
Fix pg_statio_all_tables view for multiple TOAST indexes. A TOAST table can normally have only one index, but there are corner cases where it has more; for example, transiently during REINDEX CONCURRENTLY. In such a case, the pg_statio_all_tables view produced multiple rows for the owning table,

pgsql: Remove unused module imports from TAP tests

2022-03-24 Thread Daniel Gustafsson
Remove unused module imports from TAP tests The Config and Cwd modules were no longer used, but remained imported, in a number of tests. Remove to keep the imports to the actually used modules. Reviewed-by: Andrew Dunstan Discussion: https://postgr.es/m/a5a074cd-3198-492b-be5e-7961efc37...@yesq

pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

2022-03-24 Thread Robert Haas
Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. If TRUNCATE causes some buffers to be invalidated and thus the checkpoint does not flush them, TRUNCATE must also ensure that the corresponding files are truncated on disk. Otherwise, a replay from the checkpoint might find that the

pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

2022-03-24 Thread Robert Haas
Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. If TRUNCATE causes some buffers to be invalidated and thus the checkpoint does not flush them, TRUNCATE must also ensure that the corresponding files are truncated on disk. Otherwise, a replay from the checkpoint might find that the

pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

2022-03-24 Thread Robert Haas
Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. If TRUNCATE causes some buffers to be invalidated and thus the checkpoint does not flush them, TRUNCATE must also ensure that the corresponding files are truncated on disk. Otherwise, a replay from the checkpoint might find that the

pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

2022-03-24 Thread Robert Haas
Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. If TRUNCATE causes some buffers to be invalidated and thus the checkpoint does not flush them, TRUNCATE must also ensure that the corresponding files are truncated on disk. Otherwise, a replay from the checkpoint might find that the

pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

2022-03-24 Thread Robert Haas
Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. If TRUNCATE causes some buffers to be invalidated and thus the checkpoint does not flush them, TRUNCATE must also ensure that the corresponding files are truncated on disk. Otherwise, a replay from the checkpoint might find that the

pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

2022-03-24 Thread Robert Haas
Fix possible recovery trouble if TRUNCATE overlaps a checkpoint. If TRUNCATE causes some buffers to be invalidated and thus the checkpoint does not flush them, TRUNCATE must also ensure that the corresponding files are truncated on disk. Otherwise, a replay from the checkpoint might find that the

Re: pgsql: Change fastgetattr and heap_getattr to inline functions

2022-03-24 Thread Alvaro Herrera
On 2022-Mar-24, Tom Lane wrote: > wrasse isn't happy with this: > > ccache /opt/developerstudio12.6/bin/cc -m64 -Xa -v -O pg_resetwal.o > -L../../../src/port -L../../../src/common -L/home/nm/sw/nopath/uuid-64/lib > -L/home/nm/sw/nopath/openldap-64/lib -Wl,--as-needed > -Wl,-R'/home/nm/farm/

pgsql: Wrap inline function definitions in #ifndef FRONTEND

2022-03-24 Thread Alvaro Herrera
Wrap inline function definitions in #ifndef FRONTEND This should fix failures under certain compilers (a well known limitation). My oversight in e27f4ee0a701. Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/com

Re: pgsql: Change fastgetattr and heap_getattr to inline functions

2022-03-24 Thread Tom Lane
Alvaro Herrera writes: > Change fastgetattr and heap_getattr to inline functions wrasse isn't happy with this: ccache /opt/developerstudio12.6/bin/cc -m64 -Xa -v -O pg_resetwal.o -L../../../src/port -L../../../src/common -L/home/nm/sw/nopath/uuid-64/lib -L/home/nm/sw/nopath/openldap-64/lib

pgsql: Add decoding of sequences to built-in replication

2022-03-24 Thread Tomas Vondra
Add decoding of sequences to built-in replication This commit adds support for decoding of sequences to the built-in replication (the infrastructure was added by commit 0da92dc530). The syntax and behavior mostly mimics handling of tables, i.e. a publication may be defined as FOR ALL SEQUENCES (r

pgsql: Doc: add some documentation about serialization failure handling

2022-03-24 Thread Tom Lane
Doc: add some documentation about serialization failure handling. We weren't very explicit about when to retry such errors. Simon Riggs Discussion: https://postgr.es/m/canbhv-e+u+z4vbnyj6gzeo1fd2wp_5s+f6+kmxnn+alqe6i...@mail.gmail.com Branch -- master Details --- https://git.postgresq

pgsql: Change fastgetattr and heap_getattr to inline functions

2022-03-24 Thread Alvaro Herrera
Change fastgetattr and heap_getattr to inline functions They were macros previously, but recent callsite additions made Coverity complain about one of the assertions being always true. This change could have been made a long time ago, but the Coverity complain broke the inertia. Reviewed-by: Mic

pgsql: Invent recursive_worktable_factor GUC to replace hard-wired cons

2022-03-24 Thread Tom Lane
Invent recursive_worktable_factor GUC to replace hard-wired constant. Up to now, the planner estimated the size of a recursive query's worktable as 10 times the size of the non-recursive term. It's hard to see how to do significantly better than that automatically, but we can give users control o

pgsql: Remove unnecessary translator comment

2022-03-24 Thread Peter Eisentraut
Remove unnecessary translator comment Discussion: https://www.postgresql.org/message-id/flat/CALj2ACUfJKTmK5v%3DvF%2BH2iLkqM9Yvjsp6iXaCqAks6gDpzZh6g%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a47651447f01562dac2e007db03733e750d45b6b Modified

pgsql: doc: Improve postgres command for shared_memory_size_in_huge_pag

2022-03-24 Thread Michael Paquier
doc: Improve postgres command for shared_memory_size_in_huge_pages The command used in the documentation to retrieve the value of the runtime-computed GUC shared_memory_size_in_huge_pages would also show to the user all the log messages generated by the postmaster before and after printing the wan

pgsql: Add additional filtering options to pg_waldump.

2022-03-24 Thread Thomas Munro
Add additional filtering options to pg_waldump. Allow filtering by RelFileNode, BlockNumber, ForkNum and FPW. Author: David Christensen Reviewed-by: Japin Li Reviewed-by: Bharath Rupireddy Reviewed-by: Cary Huang Reviewed-by: Thomas Munro Discussion: https://postgr.es/m/lzzgmgm6e5.fsf%40veed