pgsql: Fix handling of NULLs when merging BRIN summaries

2023-05-18 Thread Tomas Vondra
Fix handling of NULLs when merging BRIN summaries When merging BRIN summaries, union_tuples() did not correctly update the target hasnulls/allnulls flags. When merging all-NULL summary into a summary without any NULL values, the result had both flags set to false (instead of having

pgsql: Fix handling of NULLs when merging BRIN summaries

2023-05-18 Thread Tomas Vondra
Fix handling of NULLs when merging BRIN summaries When merging BRIN summaries, union_tuples() did not correctly update the target hasnulls/allnulls flags. When merging all-NULL summary into a summary without any NULL values, the result had both flags set to false (instead of having

pgsql: Advance input pointer when LZ4 compressing data

2023-05-17 Thread Tomas Vondra
Advance input pointer when LZ4 compressing data LZ4File_write() did not advance the input pointer on subsequent invocations of LZ4F_compressUpdate(). As a result the generated compressed output would be a compressed version of the same input chunk. Tests failed to catch this error because the

pgsql: Null-terminate the output buffer of LZ4Stream_gets

2023-05-17 Thread Tomas Vondra
Null-terminate the output buffer of LZ4Stream_gets LZ4Stream_gets did not null-terminate its output buffer. The callers expected the buffer to be null-terminated and passed it around to functions such as sscanf with unintended consequences. Author: Georgios Kokolatos Reported-by: Alexander

pgsql: Support long distance matching for zstd compression

2023-04-06 Thread Tomas Vondra
t; keyword when specifying the compression method (--compress=zstd:long). Author: Justin Pryzby Reviewed-by: Tomas Vondra, Jacob Champion Discussion: https://postgr.es/m/20230224191840.gd1...@telsasoft.com Discussion: https://postgr.es/m/20220327205020.gm28...@telsasoft.com Branch -- maste

pgsql: pg_dump: Add support for zstd compression

2023-04-05 Thread Tomas Vondra
in e9960732a9. I've considered both threads when compiling the list of reviewers. Author: Justin Pryzby Reviewed-by: Tomas Vondra, Jacob Champion, Andreas Karlsson Discussion: https://postgr.es/m/20230224191840.gd1...@telsasoft.com Discussion: https://postgr.es/m/20201221194924.gi30...@telsasoft.com

pgsql: pg_dump: Use only LZ4 frame format for compression

2023-03-31 Thread Tomas Vondra
Pryzby Reported-by: Justin Pryzby Reviewed-by: Tomas Vondra Discussion: https://postgr.es/m/20230227044910.GO1653%40telsasoft.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0070b66fef21e909adb283f7faa7b1978836ad75 Modified Files -- src/bin/pg_dump

pgsql: pg_dump: Fix gzip compression of empty data

2023-03-28 Thread Tomas Vondra
. Finally, replace an unreachable pg_fatal() with a simple assert check. Reported-by: Justin Pryzby Author: Justin Pryzby, Georgios Kokolatos Reviewed-by: Georgios Kokolatos, Tomas Vondra https://postgr.es/m/20230228235834.GC30529%40telsasoft.com Branch -- master Details --- https

Re: pgsql: Fix netmask handling in inet_minmax_multi_ops

2023-03-26 Thread Tomas Vondra
On 3/20/23 10:28, Tomas Vondra wrote: > Fix netmask handling in inet_minmax_multi_ops > > When calculating distance in brin_minmax_multi_distance_inet(), the > netmask was applied incorrectly. This results in (seemingly) incorrect > ordering of values, triggering an assert.

pgsql: Unify buffer sizes in pg_dump compression API

2023-03-23 Thread Tomas Vondra
. The compression implementations still have an option to use a custom value, but considering 4kB was fine for 20+ years, I find that unlikely (and we'd probably just increase the default buffer size). Author: Georgios Kokolatos Reviewed-by: Tomas Vondra, Justin Pryzby Discussion: https://postgr.es/m

pgsql: Minor comment improvements for compress_lz4

2023-03-23 Thread Tomas Vondra
Minor comment improvements for compress_lz4 Author: Tomas Vondra Reviewed-by: Georgios Kokolatos, Justin Pryzby Discussion: https://postgr.es/m/33496f7c-3449-1426-d568-63f6bca2a...@gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Improve type handling in pg_dump's compress file API

2023-03-23 Thread Tomas Vondra
olatos Reported-by: Alexander Lakhin Reviewed-by: Tomas Vondra, Justin Pryzby Discussion: https://postgr.es/m/33496f7c-3449-1426-d568-63f6bca2a...@gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d3b57755e60c2d3cfeddbc733c6168419d874414 Modified

pgsql: Ignore BRIN indexes when checking for HOT updates

2023-03-20 Thread Tomas Vondra
as 5753d4ee32, but then got reverted by e3fcca0d0d because of correctness issues. Original patch by Josef Simanek, various fixes and improvements by Tomas Vondra and me. Authors: Matthias van de Meent, Josef Simanek, Tomas Vondra Reviewed-by: Tomas Vondra, Alvaro Herrera Discussion: https://postgr.es/m

pgsql: Fix netmask handling in inet_minmax_multi_ops

2023-03-20 Thread Tomas Vondra
Fix netmask handling in inet_minmax_multi_ops When calculating distance in brin_minmax_multi_distance_inet(), the netmask was applied incorrectly. This results in (seemingly) incorrect ordering of values, triggering an assert. For builds without asserts this is mostly harmless - we may merge

pgsql: Fix netmask handling in inet_minmax_multi_ops

2023-03-20 Thread Tomas Vondra
Fix netmask handling in inet_minmax_multi_ops When calculating distance in brin_minmax_multi_distance_inet(), the netmask was applied incorrectly. This results in (seemingly) incorrect ordering of values, triggering an assert. For builds without asserts this is mostly harmless - we may merge

pgsql: Fix netmask handling in inet_minmax_multi_ops

2023-03-20 Thread Tomas Vondra
Fix netmask handling in inet_minmax_multi_ops When calculating distance in brin_minmax_multi_distance_inet(), the netmask was applied incorrectly. This results in (seemingly) incorrect ordering of values, triggering an assert. For builds without asserts this is mostly harmless - we may merge

pgsql: Fix condition in pg_dump TAP test

2023-03-01 Thread Tomas Vondra
Fix condition in pg_dump TAP test The condition checking compression support was parenthesized incorrectly after adding lz4, so fix that. Reported-by: Justin Pryzby Discussion: https://postgr.es/m/20230227044910.go1...@telsasoft.com Branch -- master Details ---

pgsql: Improve wording in pg_dump compression docs

2023-03-01 Thread Tomas Vondra
Improve wording in pg_dump compression docs A couple minor corrections in pg_dump comments and docs, related to the recently introduced compression API. Reported-by: Justin Pryzby Discussion: https://postgr.es/m/20230227044910.go1...@telsasoft.com Branch -- master Details ---

pgsql: Add LZ4 compression to pg_dump

2023-02-23 Thread Tomas Vondra
' file suffix has been added, as well as pg_dump's compression option parsing. Author: Georgios Kokolatos Reviewed-by: Michael Paquier, Rachel Heaton, Justin Pryzby, Shi Yu, Tomas Vondra Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG

pgsql: Introduce a generic pg_dump compression API

2023-02-23 Thread Tomas Vondra
-by: Michael Paquier, Rachel Heaton, Justin Pryzby, Tomas Vondra Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss%3D%40protonmail.com Branch -- master Details --- https://git.postgresql.org/pg

pgsql: Prepare pg_dump internals for additional compression methods

2023-02-23 Thread Tomas Vondra
directly. This commit teaches pg_backup_archiver.c about the compression API, so that it can benefit from bf9aa490db (simpler code, easier addition of new compression methods). Author: Georgios Kokolatos Reviewed-by: Michael Paquier, Rachel Heaton, Justin Pryzby, Tomas Vondra Discussion: https

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix handling of multi-column BRIN indexes

2023-02-18 Thread Tomas Vondra
Fix handling of multi-column BRIN indexes When evaluating clauses on multiple scan keys of a multi-column BRIN index, we can stop processing as soon as we find a scan key eliminating the range, and the range should not be added to tbe bitmap. That's how it worked before 14, but since a681e3c107a

pgsql: Fix handling of multi-column BRIN indexes

2023-02-18 Thread Tomas Vondra
Fix handling of multi-column BRIN indexes When evaluating clauses on multiple scan keys of a multi-column BRIN index, we can stop processing as soon as we find a scan key eliminating the range, and the range should not be added to tbe bitmap. That's how it worked before 14, but since a681e3c107a

pgsql: Fix handling of multi-column BRIN indexes

2023-02-18 Thread Tomas Vondra
Fix handling of multi-column BRIN indexes When evaluating clauses on multiple scan keys of a multi-column BRIN index, we can stop processing as soon as we find a scan key eliminating the range, and the range should not be added to tbe bitmap. That's how it worked before 14, but since a681e3c107a

pgsql: Check relkind before using TABLESAMPLE in postgres_fdw

2023-01-07 Thread Tomas Vondra
Check relkind before using TABLESAMPLE in postgres_fdw Check the remote relkind before trying to use TABLESAMPLE to acquire sample from the remote relation. Even if the remote server version has TABLESAMPLE support, the foreign table may point to incompatible relkind (e.g. a view or a sequence).

pgsql: Fix stale comment about sample_frac adjustment

2023-01-06 Thread Tomas Vondra
Fix stale comment about sample_frac adjustment A comment was left behind referencing sample rate adjustment removed from 8ad51b5f44. So clean that up. While at it also remove the sample rate clamping which should not be necessary without the clamping, and just check that with an assert.

pgsql: Sample postgres_fdw tables remotely during ANALYZE

2022-12-30 Thread Tomas Vondra
Sample postgres_fdw tables remotely during ANALYZE When collecting ANALYZE sample on foreign tables, postgres_fdw fetched all rows and performed the sampling locally. For large tables this means transferring and immediately discarding large amounts of data. This commit allows the sampling to be

pgsql: Fix assert in BRIN build_distances

2022-12-30 Thread Tomas Vondra
Fix assert in BRIN build_distances When brin_minmax_multi_union merges summaries, we may end up with just a single range after merge_overlapping_ranges. The summaries may contain just one range each, and they may overlap (or be exactly the same). With a single range there's no distance to

pgsql: Fix assert in BRIN build_distances

2022-12-30 Thread Tomas Vondra
Fix assert in BRIN build_distances When brin_minmax_multi_union merges summaries, we may end up with just a single range after merge_overlapping_ranges. The summaries may contain just one range each, and they may overlap (or be exactly the same). With a single range there's no distance to

pgsql: Fix assert in BRIN build_distances

2022-12-30 Thread Tomas Vondra
Fix assert in BRIN build_distances When brin_minmax_multi_union merges summaries, we may end up with just a single range after merge_overlapping_ranges. The summaries may contain just one range each, and they may overlap (or be exactly the same). With a single range there's no distance to

pgsql: Force parallelism in partition_aggregate

2022-09-04 Thread Tomas Vondra
parallel_setup_cost to 0, which is enough to switch to the parallel plan again. Commit 1349d2790 already made the plans parallel again, but do this anyway to keep the tests in sync with 15, to make backpatching simpler. Report and patch by David Rowley. Author: David Rowley Reviewed-by: Tomas

pgsql: Force parallelism in partition_aggregate

2022-09-04 Thread Tomas Vondra
parallel_setup_cost to 0, which is enough to switch to the parallel plan again. Report and patch by David Rowley. Author: David Rowley Reviewed-by: Tomas Vondra Discussion: https://postgr.es/m/CAApHDvpVFgWzXdtUQkjyOPhNrNvumRi_=ftgs79keaz92tn...@mail.gmail.com Branch -- REL_15_STABLE Details

pgsql: Reinstate tests accidentally removed by e3fcca0d0d

2022-09-04 Thread Tomas Vondra
Reinstate tests accidentally removed by e3fcca0d0d Commit e3fcca0d0d24 reverted modifications to HOT for BRIN, but it also removed a couple unrelated tests from stats.sql. Reinstate those tests. Reported-by: Peter Eisentraut Branch -- REL_15_STABLE Details ---

pgsql: Fix assert in logicalmsg_desc

2022-08-16 Thread Tomas Vondra
Fix assert in logicalmsg_desc The assert, introduced by 9f1cf97bb5, is intended to check if the prefix is terminated by a \0 byte, but it has two flaws. Firstly, prefix_size includes the \0 byte, so prefix[prefix_size] points to the byte after the null byte. Secondly, the check ensures the byte

pgsql: Fix assert in logicalmsg_desc

2022-08-16 Thread Tomas Vondra
Fix assert in logicalmsg_desc The assert, introduced by 9f1cf97bb5, is intended to check if the prefix is terminated by a \0 byte, but it has two flaws. Firstly, prefix_size includes the \0 byte, so prefix[prefix_size] points to the byte after the null byte. Secondly, the check ensures the byte

pgsql: Fix assert in logicalmsg_desc

2022-08-16 Thread Tomas Vondra
Fix assert in logicalmsg_desc The assert, introduced by 9f1cf97bb5, is intended to check if the prefix is terminated by a \0 byte, but it has two flaws. Firstly, prefix_size includes the \0 byte, so prefix[prefix_size] points to the byte after the null byte. Secondly, the check ensures the byte

pgsql: Reinstate tests accidentally removed by e3fcca0d0d

2022-07-18 Thread Tomas Vondra
Reinstate tests accidentally removed by e3fcca0d0d Commit e3fcca0d0d24 reverted modifications to HOT for BRIN, but it also removed a couple unrelated tests from stats.sql. Reinstate those tests. Reported-by: Peter Eisentraut Branch -- master Details ---

pgsql: Revert changes in HOT handling of BRIN indexes

2022-06-16 Thread Tomas Vondra
the page range summaries) as separate. But that requires a major changes, and it's too late for that in the current dev cycle. Reported-by: Tomas Vondra Discussion: https://postgr.es/m/05ebcb44-f383-86e3-4f31-0a97a5563...@enterprisedb.com Branch -- master Details --- https

pgsql: Revert "Logical decoding of sequences"

2022-04-07 Thread Tomas Vondra
Revert "Logical decoding of sequences" This reverts a sequence of commits, implementing features related to logical decoding and replication of sequences: - 0da92dc530c9251735fc70b20cd004d9630a1266 - 80901b32913ffa59bf157a4d88284b2b3a7511d9 - b779d7d8fdae088d70da5ed9fcd8205035676df3 -

pgsql: Optimize order of GROUP BY keys

2022-03-30 Thread Tomas Vondra
Sigaev, and later improved and reworked by Dmitry Dolgov. Reviews by a number of people, including me, Andrey Lepikhov, Claudio Freire, Ibrar Ahmed and Zhihong Yu. Author: Dmitry Dolgov, Teodor Sigaev, Tomas Vondra Reviewed-by: Tomas Vondra, Andrey Lepikhov, Claudio Freire, Ibrar Ahmed, Zhihong Yu

pgsql: Document autoanalyze limitations for partitioned tables

2022-03-28 Thread Tomas Vondra
-by: Zhihong Yu, Tomas Vondra Backpatch-through: 10 Discussion: https://postgr.es/m/20210913035409.GA10647%40telsasoft.com Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/c1e9cfaef9759442dde94f23275b4969b0a631b7 Modified Files -- doc/src/sgml

pgsql: Document autoanalyze limitations for partitioned tables

2022-03-28 Thread Tomas Vondra
-by: Zhihong Yu, Tomas Vondra Backpatch-through: 10 Discussion: https://postgr.es/m/20210913035409.GA10647%40telsasoft.com Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/0fc2455edbda035df87bbb1ea2091eb87f94bb99 Modified Files -- doc/src/sgml

pgsql: Document autoanalyze limitations for partitioned tables

2022-03-28 Thread Tomas Vondra
-by: Zhihong Yu, Tomas Vondra Backpatch-through: 10 Discussion: https://postgr.es/m/20210913035409.GA10647%40telsasoft.com Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/b36c2719132459768b29f5ca653b34f753c37329 Modified Files -- doc/src/sgml

pgsql: Document autoanalyze limitations for partitioned tables

2022-03-28 Thread Tomas Vondra
-by: Zhihong Yu, Tomas Vondra Backpatch-through: 10 Discussion: https://postgr.es/m/20210913035409.GA10647%40telsasoft.com Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/78ebfd885be563191d659d7a4ae230e199792e3f Modified Files -- doc/src/sgml

pgsql: Document autoanalyze limitations for partitioned tables

2022-03-28 Thread Tomas Vondra
-by: Zhihong Yu, Tomas Vondra Backpatch-through: 10 Discussion: https://postgr.es/m/20210913035409.GA10647%40telsasoft.com Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/6b262f353ef710704a9388d32924b8c10c7e6eaa Modified Files -- doc/src/sgml

pgsql: Document autoanalyze limitations for partitioned tables

2022-03-28 Thread Tomas Vondra
-by: Zhihong Yu, Tomas Vondra Backpatch-through: 10 Discussion: https://postgr.es/m/20210913035409.GA10647%40telsasoft.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/61fa6ca79b3c566f44831a33bb226f7358ed4511 Modified Files -- doc/src/sgml

pgsql: Wait for subscription to sync in t/031_column_list.sql

2022-03-26 Thread Tomas Vondra
Wait for subscription to sync in t/031_column_list.sql One of the TAP tests added in 923def9a53 did not wait after creating a subscription, and wait_for_catchup is not sufficient for this. So if the tablesync workers happen do not complete quickly enough, the test won't see the expected results.

pgsql: Move prattrs to the pg_publication_rel section in docs

2022-03-26 Thread Tomas Vondra
Move prattrs to the pg_publication_rel section in docs Commit 923def9a53 documented the prattrs to the pg_publication_namespace catalog, probably due to a rebase mistake. Move it to the section for the pg_publication_rel catalog. Author: Noriyoshi Shinoda Discussion:

pgsql: Allow specifying column lists for logical replication

2022-03-25 Thread Tomas Vondra
' (the default), the list defined for the leaf relation is used. Otherwise, the column list for the root partition will be used. Psql commands \dRp+ and \d now display any column lists. Author: Tomas Vondra, Alvaro Herrera, Rahila Syed Reviewed-by: Peter Eisentraut, Alvaro Herrera, Vignesh C, Ibrar Ahmed

pgsql: Minor improvements in sequence decoding code and docs

2022-03-25 Thread Tomas Vondra
Minor improvements in sequence decoding code and docs A couple minor comment improvements and code cleanups, based on post-commit feedback to the sequence decoding patch. Author: Amit Kapila, vignesh C Discussion: https://postgr.es/m/aeb2ba8d-e6f4-5486-cc4c-0d4982c29...@enterprisedb.com Branch

pgsql: Handle sequences in preprocess_pubobj_list

2022-03-25 Thread Tomas Vondra
Handle sequences in preprocess_pubobj_list Commit 75b1521dae added support for logical replication of sequences, including grammar changes, but it did not update preprocess_pubobj_list accordingly. This can cause segfaults with "continuations", i.e. when command specifies a list of objects:

pgsql: Update tab-completion for CREATE PUBLICATION with sequences

2022-03-25 Thread Tomas Vondra
Update tab-completion for CREATE PUBLICATION with sequences Commit 75b1521dae added support for sequences to built-in replication, but the tab-completion was updated only for ALTER PUBLICATION, not for CREATE PUBLICATION. Report and patch by Masahiko Sawada. Author: Masahiko Sawada Discussion:

pgsql: Add decoding of sequences to built-in replication

2022-03-24 Thread Tomas Vondra
increments. A new system view pg_publication_sequences lists all the sequences added to a publication, both directly and indirectly. Various psql commands (\d and \dRp) are improved to also display publications including a given sequence, or sequences included in a publication. Author: Tomas Vondra

Re: pgsql: Fix row filters with multiple publications

2022-03-17 Thread Tomas Vondra
On 3/17/22 20:15, Tomas Vondra wrote: > Hmm, this seems to have failed on wrasse [1], due to a timeout when > waiting for tablesync to complete: > > 2022-03-17 17:39:28.247 CET [19962:1] LOG: logical replication table > synchronization worker for subscription "sub2",

Re: pgsql: Fix row filters with multiple publications

2022-03-17 Thread Tomas Vondra
issue and we just happened to hit it now, or maybe it's introduced by either c91f71b9dc or 5a07966225. But neither of these commits touched tablesync at all, so I'm puzzled how could it happen. regards [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=wrasse=2022-03-17%2016%3A08%3

pgsql: Fix row filters with multiple publications

2022-03-17 Thread Tomas Vondra
by me, test case by Hou zj. Reviews and improvements by Amit Kapila. Author: Tomas Vondra, Hou zj, Amit Kapila Reviewed-by: Amit Kapila, Hou zj Discussion: https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com Branch -- master Details --- https://git.postgresql.org/pg

pgsql: Fix publish_as_relid with multiple publications

2022-03-16 Thread Tomas Vondra
j. Reviews and improvements by Amit Kapila. Author: Tomas Vondra, Hou zj, Amit Kapila Reviewed-by: Amit Kapila, Hou zj Discussion: https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/

pgsql: Fix publish_as_relid with multiple publications

2022-03-16 Thread Tomas Vondra
j. Reviews and improvements by Amit Kapila. Author: Tomas Vondra, Hou zj, Amit Kapila Reviewed-by: Amit Kapila, Hou zj Discussion: https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/

pgsql: Fix publish_as_relid with multiple publications

2022-03-16 Thread Tomas Vondra
j. Reviews and improvements by Amit Kapila. Author: Tomas Vondra, Hou zj, Amit Kapila Reviewed-by: Amit Kapila, Hou zj Discussion: https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com Branch -- master Details --- https://git.postgresql.org/pg/

pgsql: Stabilize test_decoding touching with sequences

2022-03-08 Thread Tomas Vondra
Stabilize test_decoding touching with sequences Some of the test_decoding regression tests are unstable due to modifying a sequence. The first increment of a sequence after a checkpoint is always logged (and thus decoded), which makes the output unpredictable. The runs are usually much shorter

pgsql: Call ReorderBufferProcessXid from sequence_decode

2022-03-07 Thread Tomas Vondra
Call ReorderBufferProcessXid from sequence_decode Commit 0da92dc530c added sequence_decode() implementing logical decoding of sequences, but it failed to call ReorderBufferProcessXid() as it should. So add the missing call. Reported-by: Amit Kapila Discussion:

Re: pgsql: Fix skip-empty-xacts with sequences in test_decoding

2022-02-14 Thread Tomas Vondra
On 2/14/22 14:36, Alvaro Herrera wrote: On 2022-Feb-13, Tomas Vondra wrote: Fixing the tests however uncovered a bug in the code, because sequence callbacks did not handle skip-empty-xacts properly. For trasactional increments we need to check/update the xact_wrote_changes flag, and emit

Re: pgsql: Fix skip-empty-xacts with sequences in test_decoding

2022-02-13 Thread Tomas Vondra
On 2/13/22 16:26, Alvaro Herrera wrote: > On 2022-Feb-12, Tomas Vondra wrote: > >> Fix skip-empty-xacts with sequences in test_decoding >> >> Regression tests need to use skip-empty-xacts = false, because there >> might be accidental concurrent activity (

Re: pgsql: Add decoding of sequences to test_decoding

2022-02-12 Thread Tomas Vondra
On 2/12/22 23:04, Andres Freund wrote: > Hi, > > On 2022-02-11 23:52:20 +0000, Tomas Vondra wrote: >> Add decoding of sequences to test_decoding >> >> Commit 0da92dc530 improved the logical decoding infrastructure to handle >> sequences, and did various changes

pgsql: Fix skip-empty-xacts with sequences in test_decoding

2022-02-12 Thread Tomas Vondra
Fix skip-empty-xacts with sequences in test_decoding Regression tests need to use skip-empty-xacts = false, because there might be accidental concurrent activity (like autovacuum), particularly on slow machines. The tests added by 80901b3291 failed to do that in a couple places, triggering

pgsql: Add decoding of sequences to test_decoding

2022-02-11 Thread Tomas Vondra
test_decoding with two callbacks to decode sequences. The decoding of sequences may be disabled using 'include-sequences', a new option of the output plugin. Author: Tomas Vondra, Cary Huang Reviewed-by: Peter Eisentraut, Hannu Krosing, Andres Freund Discussion: https://postgr.es/m/d045f3c2-6cfb

pgsql: Logical decoding of sequences

2022-02-10 Thread Tomas Vondra
tional/non-transactional handling). However, the original patch and reviews were very useful. Author: Tomas Vondra, Cary Huang Reviewed-by: Peter Eisentraut, Hannu Krosing, Andres Freund Discussion: https://postgr.es/m/d045f3c2-6cfb-06d3-5540-e63c320df...@enterprisedb.com Discussion: https://p

pgsql: Fix ordering of XIDs in ProcArrayApplyRecoveryInfo

2022-01-27 Thread Tomas Vondra
Fix ordering of XIDs in ProcArrayApplyRecoveryInfo Commit 8431e296ea reworked ProcArrayApplyRecoveryInfo to sort XIDs before adding them to KnownAssignedXids. But the XIDs are sorted using xidComparator, which compares the XIDs simply as uint32 values, not logically. KnownAssignedXidsAdd()

pgsql: Fix ordering of XIDs in ProcArrayApplyRecoveryInfo

2022-01-27 Thread Tomas Vondra
Fix ordering of XIDs in ProcArrayApplyRecoveryInfo Commit 8431e296ea reworked ProcArrayApplyRecoveryInfo to sort XIDs before adding them to KnownAssignedXids. But the XIDs are sorted using xidComparator, which compares the XIDs simply as uint32 values, not logically. KnownAssignedXidsAdd()

pgsql: Fix ordering of XIDs in ProcArrayApplyRecoveryInfo

2022-01-27 Thread Tomas Vondra
Fix ordering of XIDs in ProcArrayApplyRecoveryInfo Commit 8431e296ea reworked ProcArrayApplyRecoveryInfo to sort XIDs before adding them to KnownAssignedXids. But the XIDs are sorted using xidComparator, which compares the XIDs simply as uint32 values, not logically. KnownAssignedXidsAdd()

pgsql: Fix ordering of XIDs in ProcArrayApplyRecoveryInfo

2022-01-27 Thread Tomas Vondra
Fix ordering of XIDs in ProcArrayApplyRecoveryInfo Commit 8431e296ea reworked ProcArrayApplyRecoveryInfo to sort XIDs before adding them to KnownAssignedXids. But the XIDs are sorted using xidComparator, which compares the XIDs simply as uint32 values, not logically. KnownAssignedXidsAdd()

pgsql: Fix ordering of XIDs in ProcArrayApplyRecoveryInfo

2022-01-27 Thread Tomas Vondra
Fix ordering of XIDs in ProcArrayApplyRecoveryInfo Commit 8431e296ea reworked ProcArrayApplyRecoveryInfo to sort XIDs before adding them to KnownAssignedXids. But the XIDs are sorted using xidComparator, which compares the XIDs simply as uint32 values, not logically. KnownAssignedXidsAdd()

pgsql: Fix ordering of XIDs in ProcArrayApplyRecoveryInfo

2022-01-27 Thread Tomas Vondra
Fix ordering of XIDs in ProcArrayApplyRecoveryInfo Commit 8431e296ea reworked ProcArrayApplyRecoveryInfo to sort XIDs before adding them to KnownAssignedXids. But the XIDs are sorted using xidComparator, which compares the XIDs simply as uint32 values, not logically. KnownAssignedXidsAdd()

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and

pgsql: Check syscache result in AlterStatistics

2022-01-22 Thread Tomas Vondra
Check syscache result in AlterStatistics The syscache lookup may return NULL even for valid OID, for example due to a concurrent DROP STATISTICS, so a HeapTupleIsValid is necessary. Without it, it may fail with a segfault. Reported by Alexander Lakhin, patch by me. Backpatch to 13, where ALTER

pgsql: Correct type of front_pathkey to PathKey

2022-01-22 Thread Tomas Vondra
Correct type of front_pathkey to PathKey In sort_inner_and_outer we iterate a list of PathKey elements, but the variable is declared as (List *). This mistake is benign, because we only pass the pointer to lcons() and never dereference it. This exists since ~2004, but it's confusing. So fix and

pgsql: Check syscache result in AlterStatistics

2022-01-22 Thread Tomas Vondra
Check syscache result in AlterStatistics The syscache lookup may return NULL even for valid OID, for example due to a concurrent DROP STATISTICS, so a HeapTupleIsValid is necessary. Without it, it may fail with a segfault. Reported by Alexander Lakhin, patch by me. Backpatch to 13, where ALTER

pgsql: Check syscache result in AlterStatistics

2022-01-22 Thread Tomas Vondra
Check syscache result in AlterStatistics The syscache lookup may return NULL even for valid OID, for example due to a concurrent DROP STATISTICS, so a HeapTupleIsValid is necessary. Without it, it may fail with a segfault. Reported by Alexander Lakhin, patch by me. Backpatch to 13, where ALTER

pgsql: Add stxdinherit flag to pg_statistic_ext_data

2022-01-16 Thread Tomas Vondra
pg_statistic_ext_data in CREATE STATISTICS, and instead make that a responsibility of ANALYZE. Which is what we do for regular statistics too. Patch by me, with extensive improvements and fixes by Justin Pryzby. Author: Tomas Vondra, Justin Pryzby Reviewed-by: Tomas Vondra, Justin Pryzby Discussion: https

pgsql: Build inherited extended stats on partitioned tables

2022-01-15 Thread Tomas Vondra
Build inherited extended stats on partitioned tables Commit 859b3003de disabled building of extended stats for inheritance trees, to prevent updating the same catalog row twice. While that resolved the issue, it also means there are no extended stats for declaratively partitioned tables, because

pgsql: Build inherited extended stats on partitioned tables

2022-01-15 Thread Tomas Vondra
Build inherited extended stats on partitioned tables Commit 859b3003de disabled building of extended stats for inheritance trees, to prevent updating the same catalog row twice. While that resolved the issue, it also means there are no extended stats for declaratively partitioned tables, because

pgsql: Build inherited extended stats on partitioned tables

2022-01-15 Thread Tomas Vondra
Build inherited extended stats on partitioned tables Commit 859b3003de disabled building of extended stats for inheritance trees, to prevent updating the same catalog row twice. While that resolved the issue, it also means there are no extended stats for declaratively partitioned tables, because

pgsql: Build inherited extended stats on partitioned tables

2022-01-15 Thread Tomas Vondra
Build inherited extended stats on partitioned tables Commit 859b3003de disabled building of extended stats for inheritance trees, to prevent updating the same catalog row twice. While that resolved the issue, it also means there are no extended stats for declaratively partitioned tables, because

pgsql: Build inherited extended stats on partitioned tables

2022-01-15 Thread Tomas Vondra
Build inherited extended stats on partitioned tables Commit 859b3003de disabled building of extended stats for inheritance trees, to prevent updating the same catalog row twice. While that resolved the issue, it also means there are no extended stats for declaratively partitioned tables, because

pgsql: Build inherited extended stats on partitioned tables

2022-01-15 Thread Tomas Vondra
Build inherited extended stats on partitioned tables Commit 859b3003de disabled building of extended stats for inheritance trees, to prevent updating the same catalog row twice. While that resolved the issue, it also means there are no extended stats for declaratively partitioned tables, because

pgsql: Ignore extended statistics for inheritance trees

2022-01-14 Thread Tomas Vondra
Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the

pgsql: Ignore extended statistics for inheritance trees

2022-01-14 Thread Tomas Vondra
Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the

pgsql: Ignore extended statistics for inheritance trees

2022-01-14 Thread Tomas Vondra
Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the

pgsql: Ignore extended statistics for inheritance trees

2022-01-14 Thread Tomas Vondra
Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the

pgsql: Ignore extended statistics for inheritance trees

2022-01-14 Thread Tomas Vondra
Ignore extended statistics for inheritance trees Since commit 859b3003de we only build extended statistics for individual relations, ignoring the child relations. This resolved the issue with updating catalog tuple twice, but we still tried to use the statistics when calculating estimates for the

<    1   2   3   4   5   6   >