pgsql: Change type of pg_statistic_ext.stxstattarget

2023-07-02 Thread Peter Eisentraut
Change type of pg_statistic_ext.stxstattarget Change from int32 to int16, to match attstattarget (changed in 90189eefc1). Reviewed-by: Tomas Vondra Discussion: https://www.postgresql.org/message-id/flat/d6069765-5971-04d3-c10d-e4f7b2e9c459%40eisentraut.org Branch -- master Details

pgsql: Take pg_attribute out of VacAttrStats

2023-07-02 Thread Peter Eisentraut
Take pg_attribute out of VacAttrStats The VacAttrStats structure contained the whole Form_pg_attribute for a column, but it actually only needs attstattarget from there. So remove the Form_pg_attribute field and make a separate field for attstattarget. This simplifies some code for extended

pgsql: Add macro for maximum statistics target

2023-07-02 Thread Peter Eisentraut
Add macro for maximum statistics target The number of places where 1 was hardcoded had grown a bit beyond the comfort level. Introduce a macro MAX_STATISTICS_TARGET instead. Reviewed-by: Tomas Vondra Discussion:

pgsql: Remove support for OpenSSL 1.0.1

2023-07-02 Thread Michael Paquier
Remove support for OpenSSL 1.0.1 Here are some notes about this change: - As X509_get_signature_nid() should always exist (OpenSSL and LibreSSL), hence HAVE_X509_GET_SIGNATURE_NID is now gone. - OPENSSL_API_COMPAT is bumped to 0x10002000L. - One comment related to 1.0.1e introduced by 74242c2 is

Re: pgsql: Introduce bloom_filter_size for BRIN bloom opclass

2023-07-02 Thread Andrew Dunstan
On 2023-07-02 Su 20:30, Tom Lane wrote: Michael Paquier writes: koel has failed its indent step after these commits. I am unsure whether you need to fix this as it does not seem that we have a consensus to automate that, just FYI. Well, *somebody* has to fix it, otherwise why did we set up

pgsql: Refactor some code related to wait events "BufferPin" and "Exten

2023-07-02 Thread Michael Paquier
Refactor some code related to wait events "BufferPin" and "Extension" The following changes are done: - Addition of WaitEventBufferPin and WaitEventExtension, that hold a list of wait events related to each category. - Addition of two functions that encapsulate the list of wait events for each

pgsql: Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

2023-07-02 Thread Michael Paquier
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for

pgsql: Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

2023-07-02 Thread Michael Paquier
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for

pgsql: Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

2023-07-02 Thread Michael Paquier
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for

pgsql: Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

2023-07-02 Thread Michael Paquier
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for

pgsql: Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

2023-07-02 Thread Michael Paquier
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for

pgsql: Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

2023-07-02 Thread Michael Paquier
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for

pgsql: Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

2023-07-02 Thread Michael Paquier
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for

pgsql: Remove redundant PARTITION BY columns from WindowClauses

2023-07-02 Thread David Rowley
Remove redundant PARTITION BY columns from WindowClauses Here we adjust the query planner to have it remove items from a window clause's PARTITION BY clause in cases where the pathkey for a column in the PARTITION BY clause is redundant. Doing this allows the optimization added in 9d9c02ccd to

Re: pgsql: Introduce bloom_filter_size for BRIN bloom opclass

2023-07-02 Thread Tom Lane
Michael Paquier writes: > koel has failed its indent step after these commits. I am unsure > whether you need to fix this as it does not seem that we have a > consensus to automate that, just FYI. Well, *somebody* has to fix it, otherwise why did we set up the animal? But the impression I had

Re: pgsql: Introduce bloom_filter_size for BRIN bloom opclass

2023-07-02 Thread Michael Paquier
On Sun, Jul 02, 2023 at 08:25:34AM +, Tomas Vondra wrote: > 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

pgsql: Silence "missing contrecord" error.

2023-07-02 Thread Thomas Munro
Silence "missing contrecord" error. Commit dd38ff28ad added a new error message "missing contrecord" when we fail to reassemble a record. Unfortunately that caused noisy messages to be logged by pg_waldump at end of segment, and by walsender when asked to shut down on a segment boundary. Remove

pgsql: Silence "missing contrecord" error.

2023-07-02 Thread Thomas Munro
Silence "missing contrecord" error. Commit dd38ff28ad added a new error message "missing contrecord" when we fail to reassemble a record. Unfortunately that caused noisy messages to be logged by pg_waldump at end of segment, and by walsender when asked to shut down on a segment boundary. Remove

pgsql: Silence "missing contrecord" error.

2023-07-02 Thread Thomas Munro
Silence "missing contrecord" error. Commit dd38ff28ad added a new error message "missing contrecord" when we fail to reassemble a record. Unfortunately that caused noisy messages to be logged by pg_waldump at end of segment, and by walsender when asked to shut down on a segment boundary. Remove

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