pgsql: Reflect normalization of query strings for utilities in pg_stat_

2023-03-07 Thread Michael Paquier
Reflect normalization of query strings for utilities in pg_stat_statements Applying normalization changes how the following query strings are reflected in pg_stat_statements, by showing Const nodes with a dollar-signed parameter as this is how such queries are structured internally once parsed: -

pgsql: Fix corruption due to vacuum_defer_cleanup_age underflowing 64bi

2023-03-07 Thread Andres Freund
Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids When vacuum_defer_cleanup_age is bigger than the current xid, including the epoch, the subtraction of vacuum_defer_cleanup_age would lead to a wrapped around xid. While that normally is not a problem, the subsequent conversion

pgsql: Fix corruption due to vacuum_defer_cleanup_age underflowing 64bi

2023-03-07 Thread Andres Freund
Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids When vacuum_defer_cleanup_age is bigger than the current xid, including the epoch, the subtraction of vacuum_defer_cleanup_age would lead to a wrapped around xid. While that normally is not a problem, the subsequent conversion

pgsql: Fix corruption due to vacuum_defer_cleanup_age underflowing 64bi

2023-03-07 Thread Andres Freund
Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids When vacuum_defer_cleanup_age is bigger than the current xid, including the epoch, the subtraction of vacuum_defer_cleanup_age would lead to a wrapped around xid. While that normally is not a problem, the subsequent conversion

pgsql: Fix corruption due to vacuum_defer_cleanup_age underflowing 64bi

2023-03-07 Thread Andres Freund
Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids When vacuum_defer_cleanup_age is bigger than the current xid, including the epoch, the subtraction of vacuum_defer_cleanup_age would lead to a wrapped around xid. While that normally is not a problem, the subsequent conversion

pgsql: Fix corruption due to vacuum_defer_cleanup_age underflowing 64bi

2023-03-07 Thread Andres Freund
Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids When vacuum_defer_cleanup_age is bigger than the current xid, including the epoch, the subtraction of vacuum_defer_cleanup_age would lead to a wrapped around xid. While that normally is not a problem, the subsequent conversion

pgsql: Refine query jumbling handling for CallStmt

2023-03-07 Thread Michael Paquier
Refine query jumbling handling for CallStmt Previously, all the nodes of CallStmt were included in the jumbling, causing a duplicate in the computation as the transformed state of the CALL query was included as well as the parsed state (transformed FuncCall with all the input arguments and potenti

pgsql: meson: don't require 'touch' binary, make use of 'cp' optional

2023-03-07 Thread Andres Freund
meson: don't require 'touch' binary, make use of 'cp' optional We already didn't use touch (some earlier version of the meson build did ), and cp is only used for updating unicode files. The latter already depends on the optional availability of 'wget', so doing the same for 'cp' makes sense. Eve

pgsql: Ignore IntoClause.viewQuery in query jumbling

2023-03-07 Thread Michael Paquier
Ignore IntoClause.viewQuery in query jumbling IntoClause.viewQuery is a copy of the parsed-but-not-rewritten SELECT clause copied to IntoClause when transforming CreateTableAsStmt for a materialized view. Including a second copy of the SELECT Query into the query jumbling was leading to an incorr

pgsql: Improve readability of code PROCESS_MAIN in vacuum_rel()

2023-03-07 Thread Michael Paquier
Improve readability of code PROCESS_MAIN in vacuum_rel() 4211fbd has been handling PROCESS_MAIN in vacuum_rel() with an "if/else if" structure to avoid an extra level of indentation, but this has been found as being rather parse to read. This commit updates the code so as we check for PROCESS_MAI

pgsql: Fix more bugs caused by adding columns to the end of a view.

2023-03-07 Thread Tom Lane
Fix more bugs caused by adding columns to the end of a view. If a view is defined atop another view, and then CREATE OR REPLACE VIEW is used to add columns to the lower view, then when the upper view's referencing RTE is expanded by ApplyRetrieveRule we will have a subquery RTE with fewer eref->co

pgsql: Fix more bugs caused by adding columns to the end of a view.

2023-03-07 Thread Tom Lane
Fix more bugs caused by adding columns to the end of a view. If a view is defined atop another view, and then CREATE OR REPLACE VIEW is used to add columns to the lower view, then when the upper view's referencing RTE is expanded by ApplyRetrieveRule we will have a subquery RTE with fewer eref->co

pgsql: Fix more bugs caused by adding columns to the end of a view.

2023-03-07 Thread Tom Lane
Fix more bugs caused by adding columns to the end of a view. If a view is defined atop another view, and then CREATE OR REPLACE VIEW is used to add columns to the lower view, then when the upper view's referencing RTE is expanded by ApplyRetrieveRule we will have a subquery RTE with fewer eref->co

pgsql: Fix more bugs caused by adding columns to the end of a view.

2023-03-07 Thread Tom Lane
Fix more bugs caused by adding columns to the end of a view. If a view is defined atop another view, and then CREATE OR REPLACE VIEW is used to add columns to the lower view, then when the upper view's referencing RTE is expanded by ApplyRetrieveRule we will have a subquery RTE with fewer eref->co

pgsql: Fix more bugs caused by adding columns to the end of a view.

2023-03-07 Thread Tom Lane
Fix more bugs caused by adding columns to the end of a view. If a view is defined atop another view, and then CREATE OR REPLACE VIEW is used to add columns to the lower view, then when the upper view's referencing RTE is expanded by ApplyRetrieveRule we will have a subquery RTE with fewer eref->co

pgsql: Fix more bugs caused by adding columns to the end of a view.

2023-03-07 Thread Tom Lane
Fix more bugs caused by adding columns to the end of a view. If a view is defined atop another view, and then CREATE OR REPLACE VIEW is used to add columns to the lower view, then when the upper view's referencing RTE is expanded by ApplyRetrieveRule we will have a subquery RTE with fewer eref->co

pgsql: Add support for unit "B" to pg_size_bytes()

2023-03-07 Thread Peter Eisentraut
Add support for unit "B" to pg_size_bytes() This makes it consistent with the units support in GUC. Reviewed-by: David Rowley Reviewed-by: Dean Rasheed Discussion: https://www.postgresql.org/message-id/flat/0106914a-9eb5-22be-40d8-652cc88c827d%40enterprisedb.com Branch -- master Details

pgsql: doc: Update pg_size_pretty documentation about petabytes support

2023-03-07 Thread Peter Eisentraut
doc: Update pg_size_pretty documentation about petabytes support Missing documentation update for ca2e4472ba. Discussion: https://www.postgresql.org/message-id/CAApHDvrCwMgSD_93LZr4CLMas8Hc61fXAQ-Cd4%3D%2ByoRfHnYbJA%40mail.gmail.com Branch -- REL_15_STABLE Details --- https://git.postg

pgsql: doc: Update pg_size_pretty documentation about petabytes support

2023-03-07 Thread Peter Eisentraut
doc: Update pg_size_pretty documentation about petabytes support Missing documentation update for ca2e4472ba. Discussion: https://www.postgresql.org/message-id/CAApHDvrCwMgSD_93LZr4CLMas8Hc61fXAQ-Cd4%3D%2ByoRfHnYbJA%40mail.gmail.com Branch -- master Details --- https://git.postgresql.o

pgsql: Fix flakey pg_stat_io test

2023-03-07 Thread Andres Freund
Fix flakey pg_stat_io test Wrap test of pg_stat_io's tracking of shared buffer reads in a transaction to prevent concurrent accesses (e.g. by autovacuum) causing spurious test failures. Reported-by: Tom Lane Author: Melanie Plageman Discussion: https://www.postgresql.org/message-id/20230306190