pgsql: createdb: compare strategy case-insensitive

2024-04-21 Thread Tomas Vondra
createdb: compare strategy case-insensitive When specifying the createdb strategy, the documentation suggests valid options are FILE_COPY and WAL_LOG, but the code does case-sensitive comparison and accepts only "file_copy" and "wal_log" as valid. Fixed by doing a case-insensitive comparison

pgsql: createdb: compare strategy case-insensitive

2024-04-21 Thread Tomas Vondra
createdb: compare strategy case-insensitive When specifying the createdb strategy, the documentation suggests valid options are FILE_COPY and WAL_LOG, but the code does case-sensitive comparison and accepts only "file_copy" and "wal_log" as valid. Fixed by doing a case-insensitive comparison

pgsql: createdb: compare strategy case-insensitive

2024-04-21 Thread Tomas Vondra
createdb: compare strategy case-insensitive When specifying the createdb strategy, the documentation suggests valid options are FILE_COPY and WAL_LOG, but the code does case-sensitive comparison and accepts only "file_copy" and "wal_log" as valid. Fixed by doing a case-insensitive comparison

Re: pgsql: createdb: Correct parameter name in SGML docs

2024-04-21 Thread Tomas Vondra
On 4/21/24 03:25, Justin Pryzby wrote: > should be backpatched to v15 > https://www.postgresql.org/docs/15/app-createdb.html > Done. I realized the backpatching late after thinking about the other createdb issue I ran into, but it was late so I left it for today. T. -- Tom

pgsql: createdb: Correct parameter name in SGML docs

2024-04-21 Thread Tomas Vondra
createdb: Correct parameter name in SGML docs Commit 9c08aea6a309 introduced -S/--strategy option, but forgot to rename the parameter when copying the -T/--template bit. Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/722f17049729600e3a885b1c1d975a0b0fa2e1e4

pgsql: createdb: Correct parameter name in SGML docs

2024-04-21 Thread Tomas Vondra
createdb: Correct parameter name in SGML docs Commit 9c08aea6a309 introduced -S/--strategy option, but forgot to rename the parameter when copying the -T/--template bit. Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/877a64869996b702bb9cd5b39ebbc45febcd081a

pgsql: createdb: Correct parameter name in SGML docs

2024-04-20 Thread Tomas Vondra
createdb: Correct parameter name in SGML docs Commit 9c08aea6a309 introduced -S/--strategy option, but forgot to rename the parameter when copying the -T/--template bit. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f4fdc24aa35c2268f519905a3a66658ebd55a466

pgsql: Fix a couple typos in BRIN code

2024-04-19 Thread Tomas Vondra
Fix a couple typos in BRIN code Typos introduced by commits c1ec02be1d79, b43757171470 and dae761a87eda. Author: Alvaro Herrera Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/202401091043.e3nrqiad6gb7@alvherre.pgsql Branch -- master Details ---

pgsql: Add missing index_insert_cleanup calls

2024-04-19 Thread Tomas Vondra
the index as the first argument, to make it more like the other AM callbacks. And the aminsertcleanup() callback is invoked even if the ii_AmCache is NULL, so that it can decide if the cleanup is necessary. Author: Alvaro Herrera, Tomas Vondra Reported-by: Alexander Lakhin Discussion: https

pgsql: Cleanup parallel BRIN index build code

2024-04-17 Thread Tomas Vondra
Cleanup parallel BRIN index build code Commit b43757171470 added support for parallel builds of BRIN indexes, using code similar to BTREE. But there were to be a couple unnecessary differences, particularly in how the leader waits for the workers, and merges the results. So remove these, to make

pgsql: Stabilize test of BRIN parallel create

2024-04-17 Thread Tomas Vondra
Stabilize test of BRIN parallel create As explained in 4d916dd876, the test instability is caused by delayed cleanup of deleted rows. This commit removes the DELETE, stabilizing the test without accidentally disabling parallel builds. The intent of the delete however was to produce empty ranges,

pgsql: Revert "Stabilize test of BRIN parallel create"

2024-04-17 Thread Tomas Vondra
Revert "Stabilize test of BRIN parallel create" This reverts commit 4d916dd876c3. The goal of that commit was to stabilize a test of parallel BRIN build, but using a TEMPORARY table disables parallel index builds on that table, making the test useless. Discussion:

pgsql: Stabilize test of BRIN parallel create

2024-04-16 Thread Tomas Vondra
Stabilize test of BRIN parallel create The test for parallel create of BRIN indexes added by commit 8225c2fd40 happens to be unstable - a background transaction (e.g. auto-analyze) may hold back global xmin for the initial VACUUM / CREATE INDEX. If the cleanup happens before the next CREATE

pgsql: Fix unnecessary padding in incremental backups

2024-04-14 Thread Tomas Vondra
Fix unnecessary padding in incremental backups Commit 10e3226ba13d added padding to incremental backups to ensure the block data is properly aligned. The code in sendFile() however failed to consider that the header may be a multiple of BLCKSZ and thus already aligned, adding a full BLCKSZ of

pgsql: Add regression test for BRIN parallel builds

2024-04-14 Thread Tomas Vondra
Add regression test for BRIN parallel builds Adds a regression test for parallel CREATE INDEX for BRIN indexes, to improve coverage for BRIN code, particularly code to allow parallel index builds introduced by b43757171470. The test is added to pageinspect, as that allows comparing the index to

pgsql: Use the correct PG_DETOAST_DATUM macro in BRIN

2024-04-14 Thread Tomas Vondra
Use the correct PG_DETOAST_DATUM macro in BRIN Commit 6bcda4a721 replaced PG_DETOAST_DATUM with PG_DETOAST_DATUM_PACKED in two BRIN output functions, for minmax-multi and bloom opclasses. But this is incorrect - the code is accessing the data through structs that already include a 4B header, so

pgsql: Use the correct PG_DETOAST_DATUM macro in BRIN

2024-04-14 Thread Tomas Vondra
Use the correct PG_DETOAST_DATUM macro in BRIN Commit 6bcda4a721 replaced PG_DETOAST_DATUM with PG_DETOAST_DATUM_PACKED in two BRIN output functions, for minmax-multi and bloom opclasses. But this is incorrect - the code is accessing the data through structs that already include a 4B header, so

pgsql: Update nbits_set in brin_bloom_union

2024-04-14 Thread Tomas Vondra
Update nbits_set in brin_bloom_union Properly update the number of bits set in the bitmap after merging the filters in brin_bloom_union. This is mostly harmless, as the counter is used only in the output function, which means pageinspect may show incorrect information about the BRIN summary. The

pgsql: Update nbits_set in brin_bloom_union

2024-04-14 Thread Tomas Vondra
Update nbits_set in brin_bloom_union Properly update the number of bits set in the bitmap after merging the filters in brin_bloom_union. This is mostly harmless, as the counter is used only in the output function, which means pageinspect may show incorrect information about the BRIN summary. The

pgsql: Update nbits_set in brin_bloom_union

2024-04-14 Thread Tomas Vondra
Update nbits_set in brin_bloom_union Properly update the number of bits set in the bitmap after merging the filters in brin_bloom_union. This is mostly harmless, as the counter is used only in the output function, which means pageinspect may show incorrect information about the BRIN summary. The

pgsql: Update nbits_set in brin_bloom_union

2024-04-14 Thread Tomas Vondra
Update nbits_set in brin_bloom_union Properly update the number of bits set in the bitmap after merging the filters in brin_bloom_union. This is mostly harmless, as the counter is used only in the output function, which means pageinspect may show incorrect information about the BRIN summary. The

pgsql: Change BitmapAdjustPrefetchIterator to accept BlockNumber

2024-04-06 Thread Tomas Vondra
the TBMIterateResult outside of table AM specific code. Author: Melanie Plageman Reviewed-by: Tomas Vondra, Andres Freund, Heikki Linnakangas Discussion: https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com Branch -- master Details --- https

pgsql: BitmapHeapScan: Use correct recheck flag for skip_fetch

2024-04-06 Thread Tomas Vondra
the recheck flag for the block we're considering prefetching, so we can use that. The impact is very limited in practice - the opclass would need to assign different recheck flags to different blocks, but none of the built-in opclasses seems to do that. Author: Melanie Plageman Reviewed-by: Tomas

pgsql: BitmapHeapScan: Push skip_fetch optimization into table AM

2024-04-06 Thread Tomas Vondra
violation is still present in BitmapHeapScans's prefetching code, which uses the visibility map to decide whether or not to prefetch a block. However, this can be addressed independently. Author: Melanie Plageman Reviewed-by: Andres Freund, Heikki Linnakangas, Tomas Vondra, Mark Dilger Discussion

pgsql: BitmapHeapScan: postpone setting can_skip_fetch

2024-04-06 Thread Tomas Vondra
BitmapHeapScan: postpone setting can_skip_fetch Set BitmapHeapScanState->can_skip_fetch in BitmapHeapNext() instead of in ExecInitBitmapHeapScan(). This is a preliminary step to pushing the skip fetch optimization into heap AM code. Author: Melanie Plageman Reviewed-by: Tomas Vondra, And

pgsql: BitmapHeapScan: begin scan after bitmap creation

2024-04-06 Thread Tomas Vondra
() that are unavailable in ExecInitBitmapHeapScan(). Author: Melanie Plageman Reviewed-by: Tomas Vondra, Andres Freund, Heikki Linnakangas Discussion: https://postgr.es/m/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg

pgsql: Check HAVE_COPY_FILE_RANGE before calling copy_file_range

2024-04-05 Thread Tomas Vondra
Check HAVE_COPY_FILE_RANGE before calling copy_file_range Fix a mistake in ac8110155132 - write_reconstructed_file() called copy_file_range() without properly checking HAVE_COPY_FILE_RANGE. Reported by several macOS machines. Also reported by cfbot, but I missed that issue before commit. Branch

pgsql: Allow using copy_file_range in write_reconstructed_file

2024-04-05 Thread Tomas Vondra
is also read for the checksum calculation. While the checksum calculation is rarely needed when cloning whole files, when reconstructing the files from multiple backups it needs to happen almost always (the only exception is when the user specified --no-manifest). Author: Tomas Vondra Reviewed

pgsql: Remove unused variable in checksum_file()

2024-04-05 Thread Tomas Vondra
Remove unused variable in checksum_file() The 'offset' variable was set but otherwise unused. Per buildfarm animals with clang, e.g. sifaka and longlin. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8e392595e5619734db707553e8f72dfacf9ab86c Modified Files

pgsql: Allow copying files using clone/copy_file_range

2024-04-05 Thread Tomas Vondra
: Tomas Vondra, Jakub Wartak Reviewed-by: Thomas Munro, Jakub Wartak, Robert Haas Discussion: https://postgr.es/m/3024283a-7491-4240-80d0-421575f6bb23%40enterprisedb.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f8ce4ed78ca6e35bf135545e34bd49cd65d88ea2 Modified

pgsql: Align blocks in incremental backups to BLCKSZ

2024-04-05 Thread Tomas Vondra
that. Even if we determine the page size at the time of taking the backup, the backup may move. For now the BLCKSZ seems sufficient - the filesystem page is usually 4K, so the default BLCKSZ (8K by default) is aligned to that. Author: Tomas Vondra Reviewed-by: Robert Haas, Jakub Wartak Discussion

pgsql: Fix parallel BRIN builds with synchronized scans

2023-12-30 Thread Tomas Vondra
Fix parallel BRIN builds with synchronized scans The brinbuildCallbackParallel callback used by parallel BRIN builds did not consider that the parallel table scans may be synchronized, starting from an arbitrary block and then wrap around. If this happened and the scan actually did wrap around,

pgsql: Minor cleanup of the BRIN parallel build code

2023-12-30 Thread Tomas Vondra
Minor cleanup of the BRIN parallel build code Commit b437571714 added support for parallel builds for BRIN indexes, using code similar to BTREE parallel builds, and also a new tuplesort variant. This commit simplifies the new code in two ways: * The "spool" grouping tuplesort and the heap/index

pgsql: Allow parallel CREATE INDEX for BRIN indexes

2023-12-08 Thread Tomas Vondra
, certainly enough to make him a co-author. Author: Tomas Vondra, Matthias van de Meent Reviewed-by: Matthias van de Meent Discussion: https://postgr.es/m/c2ee7d69-ce17-43f2-d1a0-9811edbda6e6%40enterprisedb.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Add empty BRIN ranges during CREATE INDEX

2023-12-08 Thread Tomas Vondra
. Author: Matthias van de Meent Reviewed-by: Tomas Vondra Discussion: https://postgr.es/m/CAEze2WiMsPZg%3DxkvSF_jt4%3D69k6K7gz5B8V2wY3gCGZ%2B1BzCbQ%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/dae761a87edae444d11a411f711f1d679bed5941 Modified Files

pgsql: Check if ii_AmCache is NULL in aminsertcleanup

2023-11-27 Thread Tomas Vondra
Check if ii_AmCache is NULL in aminsertcleanup Fix a bug introduced by c1ec02be1d79. It may happen that the executor opens indexes on the result relation, but no rows end up being inserted. Then the index_insert_cleanup still gets executed, but passes down NULL to the AM callback. The AM callback

pgsql: Fix brin.c indentation issues introduced by c1ec02be1d

2023-11-26 Thread Tomas Vondra
Fix brin.c indentation issues introduced by c1ec02be1d Per buildfarm member koel. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b2caf7c0e1ebada614b6aa3004d826080a07e7e4 Modified Files -- src/backend/access/brin/brin.c | 3 ++-

pgsql: Reuse BrinDesc and BrinRevmap in brininsert

2023-11-25 Thread Tomas Vondra
ed-by: Alvaro Herrera, Matthias van de Meent, Tomas Vondra Discussion: https://postgr.es/m/CAE-ML%2B9r2%3DaO1wwji1sBN9gvPz2xRAtFUGfnffpd0ZqyuzjamA%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c1ec02be1d79eac95160dea7ced32ace84664617 M

pgsql: Lock table in DROP STATISTICS

2023-11-19 Thread Tomas Vondra
Lock table in DROP STATISTICS The DROP STATISTICS code failed to properly lock the table, leading to ERROR: tuple concurrently deleted when executed concurrently with ANALYZE. Fixed by modifying RemoveStatisticsById() to acquire the same lock as ANALYZE. This function is called only by DROP

pgsql: Lock table in DROP STATISTICS

2023-11-19 Thread Tomas Vondra
Lock table in DROP STATISTICS The DROP STATISTICS code failed to properly lock the table, leading to ERROR: tuple concurrently deleted when executed concurrently with ANALYZE. Fixed by modifying RemoveStatisticsById() to acquire the same lock as ANALYZE. This function is called only by DROP

pgsql: Lock table in DROP STATISTICS

2023-11-19 Thread Tomas Vondra
Lock table in DROP STATISTICS The DROP STATISTICS code failed to properly lock the table, leading to ERROR: tuple concurrently deleted when executed concurrently with ANALYZE. Fixed by modifying RemoveStatisticsById() to acquire the same lock as ANALYZE. This function is called only by DROP

pgsql: Lock table in DROP STATISTICS

2023-11-19 Thread Tomas Vondra
Lock table in DROP STATISTICS The DROP STATISTICS code failed to properly lock the table, leading to ERROR: tuple concurrently deleted when executed concurrently with ANALYZE. Fixed by modifying RemoveStatisticsById() to acquire the same lock as ANALYZE. This function is called only by DROP

pgsql: Lock table in DROP STATISTICS

2023-11-19 Thread Tomas Vondra
Lock table in DROP STATISTICS The DROP STATISTICS code failed to properly lock the table, leading to ERROR: tuple concurrently deleted when executed concurrently with ANALYZE. Fixed by modifying RemoveStatisticsById() to acquire the same lock as ANALYZE. This function is called only by DROP

pgsql: Lock table in DROP STATISTICS

2023-11-19 Thread Tomas Vondra
Lock table in DROP STATISTICS The DROP STATISTICS code failed to properly lock the table, leading to ERROR: tuple concurrently deleted when executed concurrently with ANALYZE. Fixed by modifying RemoveStatisticsById() to acquire the same lock as ANALYZE. This function is called only by DROP

pgsql: Fix minmax-multi on infinite date/timestamp values

2023-10-27 Thread Tomas Vondra
Fix minmax-multi on infinite date/timestamp values Make sure that infinite values in date/timestamp columns are treated as if in infinite distance. Infinite values should not be merged with other values, leaving them as outliers. The code however returned distance 0 in this case, so that infinite

pgsql: Fix minmax-multi distance for extreme interval values

2023-10-27 Thread Tomas Vondra
Fix minmax-multi distance for extreme interval values When calculating distance for interval values, the code mostly mimicked interval_mi, i.e. it built a new interval value for the difference. That however does not work for sufficiently distant interval values, when the difference overflows the

pgsql: Fix calculation in brin_minmax_multi_distance_date

2023-10-27 Thread Tomas Vondra
Fix calculation in brin_minmax_multi_distance_date When calculating the distance between date values, make sure to subtract them in the right order, i.e. (larger - smaller). The distance is used to determine which values to merge, and is expected to be a positive value. The code unfortunately

pgsql: Fix overflow when calculating timestamp distance in BRIN

2023-10-27 Thread Tomas Vondra
Fix overflow when calculating timestamp distance in BRIN When calculating distances for timestamp values for BRIN minmax-multi indexes, we need to be careful about overflows for extreme values. If the value overflows into a negative value, the index may be inefficient. The new regression test

pgsql: Fix minmax-multi on infinite date/timestamp values

2023-10-27 Thread Tomas Vondra
Fix minmax-multi on infinite date/timestamp values Make sure that infinite values in date/timestamp columns are treated as if in infinite distance. Infinite values should not be merged with other values, leaving them as outliers. The code however returned distance 0 in this case, so that infinite

pgsql: Fix overflow when calculating timestamp distance in BRIN

2023-10-27 Thread Tomas Vondra
Fix overflow when calculating timestamp distance in BRIN When calculating distances for timestamp values for BRIN minmax-multi indexes, we need to be careful about overflows for extreme values. If the value overflows into a negative value, the index may be inefficient. The new regression test

pgsql: Fix calculation in brin_minmax_multi_distance_date

2023-10-27 Thread Tomas Vondra
Fix calculation in brin_minmax_multi_distance_date When calculating the distance between date values, make sure to subtract them in the right order, i.e. (larger - smaller). The distance is used to determine which values to merge, and is expected to be a positive value. The code unfortunately

pgsql: Fix minmax-multi distance for extreme interval values

2023-10-27 Thread Tomas Vondra
Fix minmax-multi distance for extreme interval values When calculating distance for interval values, the code mostly mimicked interval_mi, i.e. it built a new interval value for the difference. That however does not work for sufficiently distant interval values, when the difference overflows the

pgsql: Fix overflow when calculating timestamp distance in BRIN

2023-10-27 Thread Tomas Vondra
Fix overflow when calculating timestamp distance in BRIN When calculating distances for timestamp values for BRIN minmax-multi indexes, we need to be careful about overflows for extreme values. If the value overflows into a negative value, the index may be inefficient. The new regression test

pgsql: Fix calculation in brin_minmax_multi_distance_date

2023-10-27 Thread Tomas Vondra
Fix calculation in brin_minmax_multi_distance_date When calculating the distance between date values, make sure to subtract them in the right order, i.e. (larger - smaller). The distance is used to determine which values to merge, and is expected to be a positive value. The code unfortunately

pgsql: Fix minmax-multi on infinite date/timestamp values

2023-10-27 Thread Tomas Vondra
Fix minmax-multi on infinite date/timestamp values Make sure that infinite values in date/timestamp columns are treated as if in infinite distance. Infinite values should not be merged with other values, leaving them as outliers. The code however returned distance 0 in this case, so that infinite

pgsql: Fix minmax-multi distance for extreme interval values

2023-10-27 Thread Tomas Vondra
Fix minmax-multi distance for extreme interval values When calculating distance for interval values, the code mostly mimicked interval_mi, i.e. it built a new interval value for the difference. That however does not work for sufficiently distant interval values, when the difference overflows the

pgsql: Fix minmax-multi distance for extreme interval values

2023-10-27 Thread Tomas Vondra
Fix minmax-multi distance for extreme interval values When calculating distance for interval values, the code mostly mimicked interval_mi, i.e. it built a new interval value for the difference. That however does not work for sufficiently distant interval values, when the difference overflows the

pgsql: Fix overflow when calculating timestamp distance in BRIN

2023-10-27 Thread Tomas Vondra
Fix overflow when calculating timestamp distance in BRIN When calculating distances for timestamp values for BRIN minmax-multi indexes, we need to be careful about overflows for extreme values. If the value overflows into a negative value, the index may be inefficient. The new regression test

pgsql: Fix calculation in brin_minmax_multi_distance_date

2023-10-27 Thread Tomas Vondra
Fix calculation in brin_minmax_multi_distance_date When calculating the distance between date values, make sure to subtract them in the right order, i.e. (larger - smaller). The distance is used to determine which values to merge, and is expected to be a positive value. The code unfortunately

pgsql: Fix minmax-multi on infinite date/timestamp values

2023-10-27 Thread Tomas Vondra
Fix minmax-multi on infinite date/timestamp values Make sure that infinite values in date/timestamp columns are treated as if in infinite distance. Infinite values should not be merged with other values, leaving them as outliers. The code however returned distance 0 in this case, so that infinite

pgsql: Document relaxed HOT for summarizing indexes

2023-07-07 Thread Tomas Vondra
van de Meent Reviewed-by: Tomas Vondra Backpatch-through: 16 Discussion: https://postgr.es/m/caeze2wieom8v+c9kueyp2bphbec5s473fuf51xneqvsfgv4...@mail.gmail.com Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/1124cb2cf2ebc1b0adb9c5289e53ffe094ce3206 Modified

pgsql: Document relaxed HOT for summarizing indexes

2023-07-07 Thread Tomas Vondra
van de Meent Reviewed-by: Tomas Vondra Backpatch-through: 16 Discussion: https://postgr.es/m/caeze2wieom8v+c9kueyp2bphbec5s473fuf51xneqvsfgv4...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ec99d6e9c87a8ff0f4805cc0c6c12cbb89c48e06 Modified Files

pgsql: Consider fillfactor when estimating relation size

2023-07-03 Thread Tomas Vondra
Consider fillfactor when estimating relation size When table_block_relation_estimate_size() estimated the number of tuples in a relation without statistics (e.g. right after load), it did not consider fillfactor when calculating density. With non-default fillfactor values, this may result in

pgsql: Remove expensive test of postgres_fdw batch inserts

2023-07-03 Thread Tomas Vondra
Remove expensive test of postgres_fdw batch inserts The test inserted 70k rows into a foreign table, in order to verify correct behavior with more than 65535 parameters, and was added in response to a bug report. However, this is rather expensive, especially when running the tests under

pgsql: Remove expensive test of postgres_fdw batch inserts

2023-07-03 Thread Tomas Vondra
Remove expensive test of postgres_fdw batch inserts The test inserted 70k rows into a foreign table, in order to verify correct behavior with more than 65535 parameters, and was added in response to a bug report. However, this is rather expensive, especially when running the tests under

pgsql: Remove expensive test of postgres_fdw batch inserts

2023-07-03 Thread Tomas Vondra
Remove expensive test of postgres_fdw batch inserts The test inserted 70k rows into a foreign table, in order to verify correct behavior with more than 65535 parameters, and was added in response to a bug report. However, this is rather expensive, especially when running the tests under

pgsql: Remove expensive test of postgres_fdw batch inserts

2023-07-03 Thread Tomas Vondra
Remove expensive test of postgres_fdw batch inserts The test inserted 70k rows into a foreign table, in order to verify correct behavior with more than 65535 parameters, and was added in response to a bug report. However, this is rather expensive, especially when running the tests under

Re: pgsql: Introduce bloom_filter_size for BRIN bloom opclass

2023-07-03 Thread Tomas Vondra
be good to spell out the expectations - perhaps it's spelled out somewhere deep in the pgindent, not sure. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company

pgsql: Fix code indentation violations

2023-07-03 Thread Tomas Vondra
Fix code indentation violations Commits ce5aaea8cd, 2b8b2852bb and 28d03feac3 violated the expected code indentation rules, upsetting the new buildfarm member "koel." Discussion: https://postgr.es/m/ZKIU4mhWpgJOM0W0%40paquier.xyz Branch -- master Details ---

pgsql: Fix oversight in handling of modifiedCols since f24523672d

2023-07-02 Thread Tomas Vondra
Fix oversight in handling of modifiedCols since f24523672d Commit f24523672d fixed a memory leak by moving the modifiedCols bitmap into the per-row memory context. In the case of AFTER UPDATE triggers, the bitmap is however referenced from an event kept until the end of the query, resulting in a

pgsql: Fix oversight in handling of modifiedCols since f24523672d

2023-07-02 Thread Tomas Vondra
Fix oversight in handling of modifiedCols since f24523672d Commit f24523672d fixed a memory leak by moving the modifiedCols bitmap into the per-row memory context. In the case of AFTER UPDATE triggers, the bitmap is however referenced from an event kept until the end of the query, resulting in a

pgsql: Fix oversight in handling of modifiedCols since f24523672d

2023-07-02 Thread Tomas Vondra
Fix oversight in handling of modifiedCols since f24523672d Commit f24523672d fixed a memory leak by moving the modifiedCols bitmap into the per-row memory context. In the case of AFTER UPDATE triggers, the bitmap is however referenced from an event kept until the end of the query, resulting in a

pgsql: Fix oversight in handling of modifiedCols since f24523672d

2023-07-02 Thread Tomas Vondra
Fix oversight in handling of modifiedCols since f24523672d Commit f24523672d fixed a memory leak by moving the modifiedCols bitmap into the per-row memory context. In the case of AFTER UPDATE triggers, the bitmap is however referenced from an event kept until the end of the query, resulting in a

pgsql: Fix oversight in handling of modifiedCols since f24523672d

2023-07-02 Thread Tomas Vondra
Fix oversight in handling of modifiedCols since f24523672d Commit f24523672d fixed a memory leak by moving the modifiedCols bitmap into the per-row memory context. In the case of AFTER UPDATE triggers, the bitmap is however referenced from an event kept until the end of the query, resulting in a

pgsql: Fix memory leak in Incremental Sort rescans

2023-07-02 Thread Tomas Vondra
Fix memory leak in Incremental Sort rescans The Incremental Sort had a couple issues, resulting in leaking memory during rescans, possibly triggering OOM. The code had a couple of related flaws: 1. During rescans, the sort states were reset but then also set to NULL (despite the comment

pgsql: Fix memory leak in Incremental Sort rescans

2023-07-02 Thread Tomas Vondra
Fix memory leak in Incremental Sort rescans The Incremental Sort had a couple issues, resulting in leaking memory during rescans, possibly triggering OOM. The code had a couple of related flaws: 1. During rescans, the sort states were reset but then also set to NULL (despite the comment

pgsql: Fix memory leak in Incremental Sort rescans

2023-07-02 Thread Tomas Vondra
Fix memory leak in Incremental Sort rescans The Incremental Sort had a couple issues, resulting in leaking memory during rescans, possibly triggering OOM. The code had a couple of related flaws: 1. During rescans, the sort states were reset but then also set to NULL (despite the comment

pgsql: Fix memory leak in Incremental Sort rescans

2023-07-02 Thread Tomas Vondra
Fix memory leak in Incremental Sort rescans The Incremental Sort had a couple issues, resulting in leaking memory during rescans, possibly triggering OOM. The code had a couple of related flaws: 1. During rescans, the sort states were reset but then also set to NULL (despite the comment

pgsql: Fix memory leak in Incremental Sort rescans

2023-07-02 Thread Tomas Vondra
Fix memory leak in Incremental Sort rescans The Incremental Sort had a couple issues, resulting in leaking memory during rescans, possibly triggering OOM. The code had a couple of related flaws: 1. During rescans, the sort states were reset but then also set to NULL (despite the comment

pgsql: Improve BRIN minmax-multi opclass test coverage

2023-07-02 Thread Tomas Vondra
Improve BRIN minmax-multi opclass test coverage Per the code coverage report, the existing regression tests did not exercice some a couple important BRIN minmax-multi code paths. - The tests focused on testing planning with a range of scan key strategies, but not the execution. Fixed by adding

pgsql: Introduce bloom_filter_size for BRIN bloom opclass

2023-07-02 Thread Tomas Vondra
Introduce bloom_filter_size for BRIN bloom opclass Move the calculation of Bloom filter parameters (for BRIN indexes) into a separate function to make reuse easier. At the moment we only call it from one place, but that may change and it's easier to read anyway. Reviewed-by: Heikki Linnakangas

pgsql: Minor cleanups in the BRIN code

2023-07-02 Thread Tomas Vondra
Minor cleanups in the BRIN code BRIN bloom and minmax-multi opclasses were somewhat inconsistent when dealing with bool variables, assigning to them Datum values etc. While not a bug, it makes the code harder to understand, so fix that. While at it, update an incorrect comment copied to bloom

pgsql: Use per-tuple context in ExecGetAllUpdatedCols

2023-06-07 Thread Tomas Vondra
the issue was introduced by fc22b6623b, but the macros were later renamed by f50e888990. Backpatch to 12, where the issue was introduced. Reported-by: Tomas Vondra Reviewed-by: Andres Freund, Tom Lane, Jakub Wartak Backpatch-through: 12 Discussion: https://postgr.es/m/222a3442-7f7d-246c-ed9b-a76209d19

pgsql: Use per-tuple context in ExecGetAllUpdatedCols

2023-06-07 Thread Tomas Vondra
the issue was introduced by fc22b6623b, but the macros were later renamed by f50e888990. Backpatch to 12, where the issue was introduced. Reported-by: Tomas Vondra Reviewed-by: Andres Freund, Tom Lane, Jakub Wartak Backpatch-through: 12 Discussion: https://postgr.es/m/222a3442-7f7d-246c-ed9b-a76209d19

pgsql: Use per-tuple context in ExecGetAllUpdatedCols

2023-06-07 Thread Tomas Vondra
the issue was introduced by fc22b6623b, but the macros were later renamed by f50e888990. Backpatch to 12, where the issue was introduced. Reported-by: Tomas Vondra Reviewed-by: Andres Freund, Tom Lane, Jakub Wartak Backpatch-through: 12 Discussion: https://postgr.es/m/222a3442-7f7d-246c-ed9b-a76209d19

pgsql: Use per-tuple context in ExecGetAllUpdatedCols

2023-06-07 Thread Tomas Vondra
the issue was introduced by fc22b6623b, but the macros were later renamed by f50e888990. Backpatch to 12, where the issue was introduced. Reported-by: Tomas Vondra Reviewed-by: Andres Freund, Tom Lane, Jakub Wartak Backpatch-through: 12 Discussion: https://postgr.es/m/222a3442-7f7d-246c-ed9b-a76209d19

pgsql: Use per-tuple context in ExecGetAllUpdatedCols

2023-06-07 Thread Tomas Vondra
the issue was introduced by fc22b6623b, but the macros were later renamed by f50e888990. Backpatch to 12, where the issue was introduced. Reported-by: Tomas Vondra Reviewed-by: Andres Freund, Tom Lane, Jakub Wartak Backpatch-through: 12 Discussion: https://postgr.es/m/222a3442-7f7d-246c-ed9b-a76209d19

pgsql: Allocate hash join files in a separate memory context

2023-05-19 Thread Tomas Vondra
on initial draft by Tomas Vondra, with significant reworks and improvements by Jehan-Guillaume de Rorthais. Author: Jehan-Guillaume de Rorthais Author: Tomas Vondra Reviewed-by: Melanie Plageman Discussion: https://postgr.es/m/20190421114618.z3mpgmimc3rmubi4@development Discussion: https://postgr.es/m

pgsql: Describe hash join implementation

2023-05-19 Thread Tomas Vondra
Describe hash join implementation Add a high level description of our implementation of the hybrid hash join algorithm to the block comment in nodeHashjoin.c. Author: Melanie Plageman Reviewed-by: Tomas Vondra Reviewed-by: Jehan-Guillaume de Rorthais Discussion: https://postgr.es/m

pgsql: Show empty BRIN ranges in brin_page_items

2023-05-18 Thread Tomas Vondra
Show empty BRIN ranges in brin_page_items Commit 3581cbdcd6 added a flag to identify empty BRIN ranges. This adds the new flag to brin_page_items() output. This is kept as a separate commit as it should not be backpatched. Reviewed-by: Justin Pryzby, Matthias van de Meent, Alvaro Herrera

pgsql: Fix handling of empty ranges and NULLs in BRIN

2023-05-18 Thread Tomas Vondra
Fix handling of empty ranges and NULLs in BRIN BRIN indexes did not properly distinguish between summaries for empty (no rows) and all-NULL ranges, treating them as essentially the same thing. Summaries were initialized with allnulls=true, and opclasses simply reset allnulls to false when

pgsql: Fix handling of empty ranges and NULLs in BRIN

2023-05-18 Thread Tomas Vondra
Fix handling of empty ranges and NULLs in BRIN BRIN indexes did not properly distinguish between summaries for empty (no rows) and all-NULL ranges, treating them as essentially the same thing. Summaries were initialized with allnulls=true, and opclasses simply reset allnulls to false when

pgsql: Fix handling of empty ranges and NULLs in BRIN

2023-05-18 Thread Tomas Vondra
Fix handling of empty ranges and NULLs in BRIN BRIN indexes did not properly distinguish between summaries for empty (no rows) and all-NULL ranges, treating them as essentially the same thing. Summaries were initialized with allnulls=true, and opclasses simply reset allnulls to false when

pgsql: Fix handling of empty ranges and NULLs in BRIN

2023-05-18 Thread Tomas Vondra
Fix handling of empty ranges and NULLs in BRIN BRIN indexes did not properly distinguish between summaries for empty (no rows) and all-NULL ranges, treating them as essentially the same thing. Summaries were initialized with allnulls=true, and opclasses simply reset allnulls to false when

pgsql: Fix handling of empty ranges and NULLs in BRIN

2023-05-18 Thread Tomas Vondra
Fix handling of empty ranges and NULLs in BRIN BRIN indexes did not properly distinguish between summaries for empty (no rows) and all-NULL ranges, treating them as essentially the same thing. Summaries were initialized with allnulls=true, and opclasses simply reset allnulls to false when

pgsql: Fix handling of empty ranges and NULLs in BRIN

2023-05-18 Thread Tomas Vondra
Fix handling of empty ranges and NULLs in BRIN BRIN indexes did not properly distinguish between summaries for empty (no rows) and all-NULL ranges, treating them as essentially the same thing. Summaries were initialized with allnulls=true, and opclasses simply reset allnulls to false when

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: 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

  1   2   3   4   5   6   >