pgsql: Allow autovacuum to log WAL usage statistics.

2020-04-06 Thread Amit Kapila
Allow autovacuum to log WAL usage statistics. This commit allows autovacuum to log WAL usage statistics added by commit df3b181499. Author: Julien Rouhaud Reviewed-by: Dilip Kumar and Amit Kapila Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4zlxws_cza3...@mail.gmail.com

pgsql: Add logical replication support to replicate into partitioned ta

2020-04-06 Thread Peter Eisentraut
Add logical replication support to replicate into partitioned tables Mainly, this adds support code in logical/worker.c for applying replicated operations whose target is a partitioned table to its relevant partitions. Author: Amit Langote Reviewed-by: Rafia Sabih Reviewed-by: Peter Eisentraut

pgsql: Re-stabilize infinite_recurse() test case.

2020-04-06 Thread Tom Lane
Re-stabilize infinite_recurse() test case. Since commit 8f59f6b9c0, CLOBBER_CACHE_ALWAYS buildfarm members have been failing this test case because the error message now sometimes includes an error cursor position. It seems largely just luck that that never happened before, and there are likely t

pgsql: Stabilize new GIN test case in 9.5 branch.

2020-04-06 Thread Tom Lane
Stabilize new GIN test case in 9.5 branch. In 9.6 and up, gin_test_tbl has autovacuum_enabled = off thanks to commit f8a1c1d5a. 9.5 lacked that, which allowed autovacuum to bollix the results of the test case added by commit 8150f7813. We could fool with disabling seqscan around that test, but ma

pgsql: Implement Incremental Sort

2020-04-06 Thread Tomas Vondra
Implement Incremental Sort Incremental Sort is an optimized variant of multikey sort for cases when the input is already sorted by a prefix of the requested sort keys. For example when the relation is already sorted by (key1, key2) and we need to sort it by (key1, key2, key3) we can simply split t

pgsql: Fix show_incremental_sort_info with force_parallel_mode

2020-04-06 Thread Tomas Vondra
Fix show_incremental_sort_info with force_parallel_mode When executed with force_parallel_mode=regress, the function was exiting too early and thus failed to print the worker stats. Fixed by making it more like show_sort_info. Discussion: https://postgr.es/m/CAPpHfds1waRZ=NOmueYq0sx1ZSCnt+5QJviz

pgsql: Fix nbtree kill_prior_tuple posting list assert.

2020-04-06 Thread Peter Geoghegan
Fix nbtree kill_prior_tuple posting list assert. An assertion added by commit 0d861bbb checked that _bt_killitems() only processes a BTScanPosItem whose heap TID is contained in a posting list tuple when its page offset number still matches what is on the page (i.e. when it matches the posting lis

pgsql: Fix failures in incremental_sort due to number of workers

2020-04-06 Thread Tomas Vondra
Fix failures in incremental_sort due to number of workers The last test in incremental_sort suite prints a parallel plan, but some of the buildfarm animals have custom max_parallel_workers_per_gather values, causing failures. Fixed by setting the GUC to an explicit value. Discussion: https://pos

pgsql: Use INT64_FORMAT when formatting int64 values in explain

2020-04-06 Thread Tomas Vondra
Use INT64_FORMAT when formatting int64 values in explain Per report from lapwing. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4bea576b032d6e5435ef0946194aada314e67691 Modified Files -- src/backend/commands/explain.c | 2 +- 1 file changed, 1 insertio

pgsql: Introduce xid8-based functions to replace txid_XXX.

2020-04-06 Thread Thomas Munro
Introduce xid8-based functions to replace txid_XXX. The txid_XXX family of fmgr functions exposes 64 bit transaction IDs to users as int8. Now that we have an SQL type xid8 for FullTransactionId, define a new set of functions including pg_current_xact_id() and pg_current_snapshot() based on that.

pgsql: Add SQL type xid8 to expose FullTransactionId to users.

2020-04-06 Thread Thomas Munro
Add SQL type xid8 to expose FullTransactionId to users. Similar to xid, but 64 bits wide. This new type is suitable for use in various system views and administration functions. Reviewed-by: Fujii Masao Reviewed-by: Takao Fujii Reviewed-by: Yoshikazu Imai Reviewed-by: Mark Dilger Discussion:

pgsql: Fix representation of SORT_TYPE_STILL_IN_PROGRESS.

2020-04-06 Thread Tom Lane
Fix representation of SORT_TYPE_STILL_IN_PROGRESS. It turns out that the code did indeed rely on a zeroed TuplesortInstrumentation.sortMethod field to indicate "this worker never did anything", although it seems the issue only comes up during certain race-condition-y cases. Hence, rearrange the T