pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Replace use of stat()[7] by -s switch in TAP tests to retrieve f

2023-10-02 Thread Michael Paquier
Replace use of stat()[7] by -s switch in TAP tests to retrieve file size The list form of stat() is an inelegant API as it relies on the position of the file size in the list returned in result. Like in any other places of the tree, replace that with a -s switch instead. Another suggestion from

pgsql: psql: Set variables from query result on failure when printing t

2023-10-01 Thread Michael Paquier
ripts that rely on the previous behavior, even if they do so accidentally. Reported-by: amutu Author: Japin Li Reviewed-by: Tom Lane, Michael Paquier Discussion: https://postgr.es/m/18134-87126d90cb4dd...@postgresql.org Branch -- master Details --- https://git.postgresql.org/pg/

pgsql: doc: Fix descriptions related to the handling of non-ASCII chara

2023-09-28 Thread Michael Paquier
doc: Fix descriptions related to the handling of non-ASCII characters Since 45b1a67a0fcb, non-printable ASCII characters do not show up in various configuration paths as question marks, but as hexadecimal escapes. The documentation was not updated to reflect that. Author: Hayato Kuroda Reviewed-

pgsql: doc: Fix descriptions related to the handling of non-ASCII chara

2023-09-28 Thread Michael Paquier
doc: Fix descriptions related to the handling of non-ASCII characters Since 45b1a67a0fcb, non-printable ASCII characters do not show up in various configuration paths as question marks, but as hexadecimal escapes. The documentation was not updated to reflect that. Author: Hayato Kuroda Reviewed-

pgsql: Show parameters of CALL as constants in pg_stat_statements

2023-09-27 Thread Michael Paquier
Show parameters of CALL as constants in pg_stat_statements This commit changes the query jumbling of CallStmt so as its IN/OUT parameters are able to show up as constants with a parameter symbol in pg_stat_statements, like: CALL proc1($1, $2); CALL proc2($1, $2, $3); The transformed FuncExpr is u

pgsql: Move tracking of in_streaming to PGOutputData

2023-09-27 Thread Michael Paquier
new field to PGOutputData, exposed in pgoutput.h. Author: Hou Zhijie Reviewed-by: Amit Kapila, Michael Paquier, Peter Smith Discussion: https://postgr.es/m/os0pr01mb571690ef24f51f51effcbb0e94...@os0pr01mb5716.jpnprd01.prod.outlook.com Branch -- master Details --- https://git.postgre

pgsql: unaccent: Tweak value of PYTHON when building without Python sup

2023-09-26 Thread Michael Paquier
unaccent: Tweak value of PYTHON when building without Python support As coded, the module's Makefile would fail to set a value for PYTHON as it checked if the variable is defined. When compiling without --with-python, PYTHON is defined and set to an empty value, so the existing check is not able

pgsql: unaccent: Tweak value of PYTHON when building without Python sup

2023-09-26 Thread Michael Paquier
unaccent: Tweak value of PYTHON when building without Python support As coded, the module's Makefile would fail to set a value for PYTHON as it checked if the variable is defined. When compiling without --with-python, PYTHON is defined and set to an empty value, so the existing check is not able

pgsql: unaccent: Tweak value of PYTHON when building without Python sup

2023-09-26 Thread Michael Paquier
unaccent: Tweak value of PYTHON when building without Python support As coded, the module's Makefile would fail to set a value for PYTHON as it checked if the variable is defined. When compiling without --with-python, PYTHON is defined and set to an empty value, so the existing check is not able

pgsql: unaccent: Tweak value of PYTHON when building without Python sup

2023-09-26 Thread Michael Paquier
unaccent: Tweak value of PYTHON when building without Python support As coded, the module's Makefile would fail to set a value for PYTHON as it checked if the variable is defined. When compiling without --with-python, PYTHON is defined and set to an empty value, so the existing check is not able

pgsql: unaccent: Tweak value of PYTHON when building without Python sup

2023-09-26 Thread Michael Paquier
unaccent: Tweak value of PYTHON when building without Python support As coded, the module's Makefile would fail to set a value for PYTHON as it checked if the variable is defined. When compiling without --with-python, PYTHON is defined and set to an empty value, so the existing check is not able

pgsql: Fix behavior of "force" in pgstat_report_wal()

2023-09-25 Thread Michael Paquier
ock could not be acquired. Before this commit, some stats on WAL and I/O could have been lost after a shutdown, for example. Reported-by: Ryoga Yoshida Author: Ryoga Yoshida, Michael Paquier Discussion: https://postgr.es/m/f87a4d7be70530606b864fd1df917...@oss.nttdata.com Backpatc

pgsql: Fix behavior of "force" in pgstat_report_wal()

2023-09-25 Thread Michael Paquier
ock could not be acquired. Before this commit, some stats on WAL and I/O could have been lost after a shutdown, for example. Reported-by: Ryoga Yoshida Author: Ryoga Yoshida, Michael Paquier Discussion: https://postgr.es/m/f87a4d7be70530606b864fd1df917...@oss.nttdata.com Backpatc

pgsql: Fix behavior of "force" in pgstat_report_wal()

2023-09-25 Thread Michael Paquier
ock could not be acquired. Before this commit, some stats on WAL and I/O could have been lost after a shutdown, for example. Reported-by: Ryoga Yoshida Author: Ryoga Yoshida, Michael Paquier Discussion: https://postgr.es/m/f87a4d7be70530606b864fd1df917...@oss.nttdata.com B

pgsql: doc: Tell about "vcregress taptest" for regression tests on Wind

2023-09-25 Thread Michael Paquier
doc: Tell about "vcregress taptest" for regression tests on Windows There was no mention of this command in the documentation, and it is useful to run the TAP tests of a target source directory. Author: Yugo Nagata Discussion: https://postgr.es/m/20230925153204.926d685d347ee1c8f5270...@sraoss.co

pgsql: doc: Tell about "vcregress taptest" for regression tests on Wind

2023-09-25 Thread Michael Paquier
doc: Tell about "vcregress taptest" for regression tests on Windows There was no mention of this command in the documentation, and it is useful to run the TAP tests of a target source directory. Author: Yugo Nagata Discussion: https://postgr.es/m/20230925153204.926d685d347ee1c8f5270...@sraoss.co

pgsql: doc: Tell about "vcregress taptest" for regression tests on Wind

2023-09-25 Thread Michael Paquier
doc: Tell about "vcregress taptest" for regression tests on Windows There was no mention of this command in the documentation, and it is useful to run the TAP tests of a target source directory. Author: Yugo Nagata Discussion: https://postgr.es/m/20230925153204.926d685d347ee1c8f5270...@sraoss.co

pgsql: doc: Tell about "vcregress taptest" for regression tests on Wind

2023-09-25 Thread Michael Paquier
doc: Tell about "vcregress taptest" for regression tests on Windows There was no mention of this command in the documentation, and it is useful to run the TAP tests of a target source directory. Author: Yugo Nagata Discussion: https://postgr.es/m/20230925153204.926d685d347ee1c8f5270...@sraoss.co

pgsql: doc: Tell about "vcregress taptest" for regression tests on Wind

2023-09-25 Thread Michael Paquier
doc: Tell about "vcregress taptest" for regression tests on Windows There was no mention of this command in the documentation, and it is useful to run the TAP tests of a target source directory. Author: Yugo Nagata Discussion: https://postgr.es/m/20230925153204.926d685d347ee1c8f5270...@sraoss.co

pgsql: doc: Tell about "vcregress taptest" for regression tests on Wind

2023-09-25 Thread Michael Paquier
doc: Tell about "vcregress taptest" for regression tests on Windows There was no mention of this command in the documentation, and it is useful to run the TAP tests of a target source directory. Author: Yugo Nagata Discussion: https://postgr.es/m/20230925153204.926d685d347ee1c8f5270...@sraoss.co

pgsql: doc: Tell about "vcregress taptest" for regression tests on Wind

2023-09-25 Thread Michael Paquier
doc: Tell about "vcregress taptest" for regression tests on Windows There was no mention of this command in the documentation, and it is useful to run the TAP tests of a target source directory. Author: Yugo Nagata Discussion: https://postgr.es/m/20230925153204.926d685d347ee1c8f5270...@sraoss.co

pgsql: unaccent: Fix allocation size for target characters on initial l

2023-09-24 Thread Michael Paquier
unaccent: Fix allocation size for target characters on initial load This led to an overestimation of the size allocated for both the quoted and non-quoted cases, while using an inconsistent style. Thinkos in 59f47fb98dab. Per report from Coverity, with extra input from Tom Lane. Branch -- m

pgsql: doc: Fix description of BUFFER_USAGE_LIMIT for VACUUM and ANALYZ

2023-09-19 Thread Michael Paquier
doc: Fix description of BUFFER_USAGE_LIMIT for VACUUM and ANALYZE BUFFER_USAGE_LIMIT requires a parameter, and 'B' is a supported unit. Author: Ryoga Yoshida Reviewed-by: Shinya Kato Discussion: https://postgr.es/m/9374034cb91b647b55a774a8980b0...@oss.nttdata.com Backpatch-through: 16 Branch ---

pgsql: doc: Fix description of BUFFER_USAGE_LIMIT for VACUUM and ANALYZ

2023-09-19 Thread Michael Paquier
doc: Fix description of BUFFER_USAGE_LIMIT for VACUUM and ANALYZE BUFFER_USAGE_LIMIT requires a parameter, and 'B' is a supported unit. Author: Ryoga Yoshida Reviewed-by: Shinya Kato Discussion: https://postgr.es/m/9374034cb91b647b55a774a8980b0...@oss.nttdata.com Backpatch-through: 16 Branch ---

pgsql: unaccent: Add support for quoted translated characters

2023-09-19 Thread Michael Paquier
be backpatched, unfortunately. The idea to use double quotes as escaped characters comes from Tom Lane. Reported-by: Martin Schlossarek Author: Michael Paquier Discussion: https://postgr.es/m/18057-62712cad01bd2...@postgresql.org Branch -- master Details --- https://git.postgresql.org/pg

pgsql: Fix typos in pgoutput.c

2023-09-19 Thread Michael Paquier
Fix typos in pgoutput.c RelationSyncCache was mentioned in two comments under a different name. Issue noticed while reviewing a different patch touching the same area. Introduced by 665d1fad99e7. Discussion: https://postgr.es/m/zqk1ca_efdtmb...@paquier.xyz Branch -- master Details ---

pgsql: psql: Reset query buffer of \e, \ef and \ev on error

2023-09-19 Thread Michael Paquier
backpatch this commit (argument particularly available for v11 that's going to be EOL'd soon). Perhaps this could be revisited later depending on the feedback of this new behavior. Author: Ryoga Yoshida, Michael Paquier Reviewed-by: Aleksander Alekseev, Kyotaro Horiguchi Discussion: https://p

pgsql: Improve error message for snapshot import in snapmgr.c, take two

2023-09-18 Thread Michael Paquier
89b66 that introduced snapshot imports. Two test cases are added to cover the cases of an identifier with an incorrect format and of a missing snapshot. Author: Bharath Rupireddy Reviewed-by: Andres Freund, Daniel Gustafsson, Michael Paquier Discussion: https://postgr.es/m/CALj2ACWmr=3kdxdkm

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Revert "Improve error message on snapshot import in snapmgr.c"

2023-09-14 Thread Michael Paquier
Revert "Improve error message on snapshot import in snapmgr.c" This reverts commit a0d87bcd9b57, following a remark from Andres Frend that the new error can be triggered with an incorrect SET TRANSACTION SNAPSHOT command without being really helpful for the user as it uses the internal file name.

pgsql: Revert "Improve error message on snapshot import in snapmgr.c"

2023-09-14 Thread Michael Paquier
Revert "Improve error message on snapshot import in snapmgr.c" This reverts commit a0d87bcd9b57, following a remark from Andres Frend that the new error can be triggered with an incorrect SET TRANSACTION SNAPSHOT command without being really helpful for the user as it uses the internal file name.

pgsql: Revert "Improve error message on snapshot import in snapmgr.c"

2023-09-14 Thread Michael Paquier
Revert "Improve error message on snapshot import in snapmgr.c" This reverts commit a0d87bcd9b57, following a remark from Andres Frend that the new error can be triggered with an incorrect SET TRANSACTION SNAPSHOT command without being really helpful for the user as it uses the internal file name.

pgsql: Revert "Improve error message on snapshot import in snapmgr.c"

2023-09-14 Thread Michael Paquier
Revert "Improve error message on snapshot import in snapmgr.c" This reverts commit a0d87bcd9b57, following a remark from Andres Frend that the new error can be triggered with an incorrect SET TRANSACTION SNAPSHOT command without being really helpful for the user as it uses the internal file name.

pgsql: Revert "Improve error message on snapshot import in snapmgr.c"

2023-09-14 Thread Michael Paquier
Revert "Improve error message on snapshot import in snapmgr.c" This reverts commit a0d87bcd9b57, following a remark from Andres Frend that the new error can be triggered with an incorrect SET TRANSACTION SNAPSHOT command without being really helpful for the user as it uses the internal file name.

pgsql: Revert "Improve error message on snapshot import in snapmgr.c"

2023-09-14 Thread Michael Paquier
Revert "Improve error message on snapshot import in snapmgr.c" This reverts commit a0d87bcd9b57, following a remark from Andres Frend that the new error can be triggered with an incorrect SET TRANSACTION SNAPSHOT command without being really helpful for the user as it uses the internal file name.

pgsql: Revert "Improve error message on snapshot import in snapmgr.c"

2023-09-14 Thread Michael Paquier
Revert "Improve error message on snapshot import in snapmgr.c" This reverts commit a0d87bcd9b57, following a remark from Andres Frend that the new error can be triggered with an incorrect SET TRANSACTION SNAPSHOT command without being really helpful for the user as it uses the internal file name.

pgsql: Improve error message on snapshot import in snapmgr.c

2023-09-13 Thread Michael Paquier
Improve error message on snapshot import in snapmgr.c When a snapshot file fails to be read in ImportSnapshot(), it would issue an ERROR as "invalid snapshot identifier" when opening a stream for it in read-only mode. This error message is reworded to be the same as all the other messages used in

pgsql: Improve error message on snapshot import in snapmgr.c

2023-09-13 Thread Michael Paquier
Improve error message on snapshot import in snapmgr.c When a snapshot file fails to be read in ImportSnapshot(), it would issue an ERROR as "invalid snapshot identifier" when opening a stream for it in read-only mode. This error message is reworded to be the same as all the other messages used in

pgsql: Improve error message on snapshot import in snapmgr.c

2023-09-13 Thread Michael Paquier
Improve error message on snapshot import in snapmgr.c When a snapshot file fails to be read in ImportSnapshot(), it would issue an ERROR as "invalid snapshot identifier" when opening a stream for it in read-only mode. This error message is reworded to be the same as all the other messages used in

pgsql: Improve error message on snapshot import in snapmgr.c

2023-09-13 Thread Michael Paquier
Improve error message on snapshot import in snapmgr.c When a snapshot file fails to be read in ImportSnapshot(), it would issue an ERROR as "invalid snapshot identifier" when opening a stream for it in read-only mode. This error message is reworded to be the same as all the other messages used in

pgsql: Improve error message on snapshot import in snapmgr.c

2023-09-13 Thread Michael Paquier
Improve error message on snapshot import in snapmgr.c When a snapshot file fails to be read in ImportSnapshot(), it would issue an ERROR as "invalid snapshot identifier" when opening a stream for it in read-only mode. This error message is reworded to be the same as all the other messages used in

pgsql: Improve error message on snapshot import in snapmgr.c

2023-09-13 Thread Michael Paquier
Improve error message on snapshot import in snapmgr.c When a snapshot file fails to be read in ImportSnapshot(), it would issue an ERROR as "invalid snapshot identifier" when opening a stream for it in read-only mode. This error message is reworded to be the same as all the other messages used in

pgsql: Improve error message on snapshot import in snapmgr.c

2023-09-13 Thread Michael Paquier
Improve error message on snapshot import in snapmgr.c When a snapshot file fails to be read in ImportSnapshot(), it would issue an ERROR as "invalid snapshot identifier" when opening a stream for it in read-only mode. This error message is reworded to be the same as all the other messages used in

pgsql: Refactor error messages for unsupported providers in pg_locale.c

2023-09-13 Thread Michael Paquier
refactors the code so as the provider is always reported even if no locale is set. The name of the function where the error happens is added, while on it, as it can be helpful for debugging. Issue introduced by d87d548cd030, so backpatch down to 16. Author: Michael Paquier, Ranier Vilela Reviewe

pgsql: Refactor error messages for unsupported providers in pg_locale.c

2023-09-13 Thread Michael Paquier
refactors the code so as the provider is always reported even if no locale is set. The name of the function where the error happens is added, while on it, as it can be helpful for debugging. Issue introduced by d87d548cd030, so backpatch down to 16. Author: Michael Paquier, Ranier Vilela Reviewe

pgsql: Switch psql's TAP test for query cancellation to use IPC::Run::s

2023-09-12 Thread Michael Paquier
Switch psql's TAP test for query cancellation to use IPC::Run::signal() Previously, the test relied on a trick with a shell to retrieve the PID of the psql session to be stopped with SIGINT, that was skipped on Windows. This commit changes the test to use IPC::Run::signal() instead, which still d

pgsql: Skip psql's TAP test for query cancellation entirely on Windows

2023-09-12 Thread Michael Paquier
Skip psql's TAP test for query cancellation entirely on Windows This changes 020_cancel.pl so as the test is entirely skipped on Windows. This test was already doing nothing under WIN32, except initializing and starting a node without using it so this shaves a few test cycles. Author: Yugo NAGAT

pgsql: Skip psql's TAP test for query cancellation entirely on Windows

2023-09-12 Thread Michael Paquier
Skip psql's TAP test for query cancellation entirely on Windows This changes 020_cancel.pl so as the test is entirely skipped on Windows. This test was already doing nothing under WIN32, except initializing and starting a node without using it so this shaves a few test cycles. Author: Yugo NAGAT

pgsql: Skip psql's TAP test for query cancellation entirely on Windows

2023-09-12 Thread Michael Paquier
Skip psql's TAP test for query cancellation entirely on Windows This changes 020_cancel.pl so as the test is entirely skipped on Windows. This test was already doing nothing under WIN32, except initializing and starting a node without using it so this shaves a few test cycles. Author: Yugo NAGAT

pgsql: Make recovery report error message when invalid page header is f

2023-09-11 Thread Michael Paquier
Make recovery report error message when invalid page header is found. Commit 0668719801 changed XLogPageRead() so that it validated the page header, if invalid page header was found reset the error message and retried reading the page, to fix the scenario where streaming standby got stuck at a con

pgsql: Make recovery report error message when invalid page header is f

2023-09-11 Thread Michael Paquier
Make recovery report error message when invalid page header is found. Commit 0668719801 changed XLogPageRead() so that it validated the page header, if invalid page header was found reset the error message and retried reading the page, to fix the scenario where streaming standby got stuck at a con

pgsql: Make recovery report error message when invalid page header is f

2023-09-11 Thread Michael Paquier
Make recovery report error message when invalid page header is found. Commit 0668719801 changed XLogPageRead() so that it validated the page header, if invalid page header was found reset the error message and retried reading the page, to fix the scenario where streaming standby got stuck at a con

pgsql: Remove redundant assignments in copyfrom.c

2023-09-09 Thread Michael Paquier
Remove redundant assignments in copyfrom.c The tuple descriptor and the number of attributes are assigned twice to the same values in BeginCopyFrom(), for what looks like a small thinko coming from the refactoring done in c532d15dddff1. Author: Jingtang Zhang Discussion: https://postgr.es/m/caps

pgsql: Improve BackendXidGetPid() to only access allProcs on matching X

2023-09-07 Thread Michael Paquier
Improve BackendXidGetPid() to only access allProcs on matching XID Compilers are able to optimize that, but it makes the code slightly more readable this way. Author: Zhao Junwang Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/caeg8a3+i9gtqf65b+g_puvacquf0rzc-emqmyejgfjyoquu...@mail

pgsql: pg_basebackup: Generate valid temporary slot names under PQbacke

2023-09-06 Thread Michael Paquier
pg_basebackup: Generate valid temporary slot names under PQbackendPID() pgbouncer can cause PQbackendPID() to return negative values due to it filling be_pid with random bytes (even these days pid_max can only be set up to 2^22 on 64b machines on Linux, for example, so this cannot happen with norm

pgsql: pg_basebackup: Generate valid temporary slot names under PQbacke

2023-09-06 Thread Michael Paquier
pg_basebackup: Generate valid temporary slot names under PQbackendPID() pgbouncer can cause PQbackendPID() to return negative values due to it filling be_pid with random bytes (even these days pid_max can only be set up to 2^22 on 64b machines on Linux, for example, so this cannot happen with norm

pgsql: pg_basebackup: Generate valid temporary slot names under PQbacke

2023-09-06 Thread Michael Paquier
pg_basebackup: Generate valid temporary slot names under PQbackendPID() pgbouncer can cause PQbackendPID() to return negative values due to it filling be_pid with random bytes (even these days pid_max can only be set up to 2^22 on 64b machines on Linux, for example, so this cannot happen with norm

pgsql: pg_basebackup: Generate valid temporary slot names under PQbacke

2023-09-06 Thread Michael Paquier
pg_basebackup: Generate valid temporary slot names under PQbackendPID() pgbouncer can cause PQbackendPID() to return negative values due to it filling be_pid with random bytes (even these days pid_max can only be set up to 2^22 on 64b machines on Linux, for example, so this cannot happen with norm

pgsql: pg_basebackup: Generate valid temporary slot names under PQbacke

2023-09-06 Thread Michael Paquier
pg_basebackup: Generate valid temporary slot names under PQbackendPID() pgbouncer can cause PQbackendPID() to return negative values due to it filling be_pid with random bytes (even these days pid_max can only be set up to 2^22 on 64b machines on Linux, for example, so this cannot happen with norm

pgsql: pg_basebackup: Generate valid temporary slot names under PQbacke

2023-09-06 Thread Michael Paquier
pg_basebackup: Generate valid temporary slot names under PQbackendPID() pgbouncer can cause PQbackendPID() to return negative values due to it filling be_pid with random bytes (even these days pid_max can only be set up to 2^22 on 64b machines on Linux, for example, so this cannot happen with norm

pgsql: pg_basebackup: Generate valid temporary slot names under PQbacke

2023-09-06 Thread Michael Paquier
pg_basebackup: Generate valid temporary slot names under PQbackendPID() pgbouncer can cause PQbackendPID() to return negative values due to it filling be_pid with random bytes (even these days pid_max can only be set up to 2^22 on 64b machines on Linux, for example, so this cannot happen with norm

pgsql: Remove column for wait event names in wait_event_names.txt

2023-09-05 Thread Michael Paquier
Remove column for wait event names in wait_event_names.txt This file is now made of two columns, removing the column listing the user-visible strings used in the system views and the documentation: - Enum definitions for each class without the prefix "WAIT_EVENT_", so as this information can be gr

pgsql: Use more consistent names for wait event objects and types

2023-09-05 Thread Michael Paquier
Use more consistent names for wait event objects and types The event names use the same case-insensitive characters, hence applying lower() or upper() to the monitoring queries allows the detection of the same events as before this change. It is possible to cross-check the data with the system vi

pgsql: Improve description of keys in tsvector

2023-09-04 Thread Michael Paquier
Improve description of keys in tsvector If all the bits of a key in a tsvector are true (marked with ALLISTRUE), gtsvectorout() would show the following description: "0 true bits, 0 false bits" This is confusing, as all the bits are true, but this would be equivalent to the information if siglen

pgsql: Fix out-of-bound read in gtsvector_picksplit()

2023-09-03 Thread Michael Paquier
Fix out-of-bound read in gtsvector_picksplit() This could lead to an imprecise choice when splitting an index page of a GiST index on a tsvector, deciding which entries should remain on the old page and which entries should move to a new page. This is wrong since tsearch2 has been moved into core

pgsql: Fix out-of-bound read in gtsvector_picksplit()

2023-09-03 Thread Michael Paquier
Fix out-of-bound read in gtsvector_picksplit() This could lead to an imprecise choice when splitting an index page of a GiST index on a tsvector, deciding which entries should remain on the old page and which entries should move to a new page. This is wrong since tsearch2 has been moved into core

pgsql: Fix out-of-bound read in gtsvector_picksplit()

2023-09-03 Thread Michael Paquier
Fix out-of-bound read in gtsvector_picksplit() This could lead to an imprecise choice when splitting an index page of a GiST index on a tsvector, deciding which entries should remain on the old page and which entries should move to a new page. This is wrong since tsearch2 has been moved into core

pgsql: Fix out-of-bound read in gtsvector_picksplit()

2023-09-03 Thread Michael Paquier
Fix out-of-bound read in gtsvector_picksplit() This could lead to an imprecise choice when splitting an index page of a GiST index on a tsvector, deciding which entries should remain on the old page and which entries should move to a new page. This is wrong since tsearch2 has been moved into core

pgsql: Fix out-of-bound read in gtsvector_picksplit()

2023-09-03 Thread Michael Paquier
Fix out-of-bound read in gtsvector_picksplit() This could lead to an imprecise choice when splitting an index page of a GiST index on a tsvector, deciding which entries should remain on the old page and which entries should move to a new page. This is wrong since tsearch2 has been moved into core

pgsql: Fix out-of-bound read in gtsvector_picksplit()

2023-09-03 Thread Michael Paquier
Fix out-of-bound read in gtsvector_picksplit() This could lead to an imprecise choice when splitting an index page of a GiST index on a tsvector, deciding which entries should remain on the old page and which entries should move to a new page. This is wrong since tsearch2 has been moved into core

pgsql: Fix out-of-bound read in gtsvector_picksplit()

2023-09-03 Thread Michael Paquier
Fix out-of-bound read in gtsvector_picksplit() This could lead to an imprecise choice when splitting an index page of a GiST index on a tsvector, deciding which entries should remain on the old page and which entries should move to a new page. This is wrong since tsearch2 has been moved into core

pgsql: Fix handling of shared statistics with dropped databases

2023-09-03 Thread Michael Paquier
Fix handling of shared statistics with dropped databases Dropping a database while a connection is attempted on it was able to lead to the presence of valid database entries in shared statistics. The issue is that MyDatabaseId was getting set too early than it should, as, if the connection attempt

pgsql: Fix handling of shared statistics with dropped databases

2023-09-03 Thread Michael Paquier
Fix handling of shared statistics with dropped databases Dropping a database while a connection is attempted on it was able to lead to the presence of valid database entries in shared statistics. The issue is that MyDatabaseId was getting set too early than it should, as, if the connection attempt

pgsql: Fix handling of shared statistics with dropped databases

2023-09-03 Thread Michael Paquier
Fix handling of shared statistics with dropped databases Dropping a database while a connection is attempted on it was able to lead to the presence of valid database entries in shared statistics. The issue is that MyDatabaseId was getting set too early than it should, as, if the connection attempt

pgsql: Fix some shadow variables in src/backend/replication/

2023-08-30 Thread Michael Paquier
Fix some shadow variables in src/backend/replication/ The code is able to compile already without warnings under -Wshadow=compatible-local, which is itself already enabled in the tree, and the ones fixed here showed up with the more restrictive -Wshadow. There are more of these that we may want t

Re: pgsql: Allow pgbench to exit immediately when any client is aborted.

2023-08-29 Thread Michael Paquier
Hi Ishii-san, On Wed, Aug 30, 2023 at 01:05:15AM +, Tatsuo Ishii wrote: > Allow pgbench to exit immediately when any client is aborted. > > Previously when client was aborted due to some error during > benchmarking, other clients continued their run until certain number > of transactions spec

pgsql: Fix comment of PQputCopyEnd()

2023-08-29 Thread Michael Paquier
Fix comment of PQputCopyEnd() The comment describing the error codes of this routine mentioned 0 as a possible value, but this error code has never been used. Author: Junwang Zhao Reviewed-by: Aleksander Alekseev Discussion: https://postgr.es/m/CAEG8a3Jt5KwMNr+_S6VN68rog4HeoG6ELvPQO8kZNQTeJeQ=r.

pgsql: Avoid possible overflow with ltsGetFreeBlock() in logtape.c

2023-08-29 Thread Michael Paquier
Avoid possible overflow with ltsGetFreeBlock() in logtape.c nFreeBlocks, defined as a long, stores the number of free blocks in a logical tape. ltsGetFreeBlock() has been using an int to store the value of nFreeBlocks, which could lead to overflows on platforms where long and int are not the same

pgsql: Avoid possible overflow with ltsGetFreeBlock() in logtape.c

2023-08-29 Thread Michael Paquier
Avoid possible overflow with ltsGetFreeBlock() in logtape.c nFreeBlocks, defined as a long, stores the number of free blocks in a logical tape. ltsGetFreeBlock() has been using an int to store the value of nFreeBlocks, which could lead to overflows on platforms where long and int are not the same

pgsql: Avoid possible overflow with ltsGetFreeBlock() in logtape.c

2023-08-29 Thread Michael Paquier
Avoid possible overflow with ltsGetFreeBlock() in logtape.c nFreeBlocks, defined as a long, stores the number of free blocks in a logical tape. ltsGetFreeBlock() has been using an int to store the value of nFreeBlocks, which could lead to overflows on platforms where long and int are not the same

pgsql: Avoid possible overflow with ltsGetFreeBlock() in logtape.c

2023-08-29 Thread Michael Paquier
Avoid possible overflow with ltsGetFreeBlock() in logtape.c nFreeBlocks, defined as a long, stores the number of free blocks in a logical tape. ltsGetFreeBlock() has been using an int to store the value of nFreeBlocks, which could lead to overflows on platforms where long and int are not the same

pgsql: Avoid possible overflow with ltsGetFreeBlock() in logtape.c

2023-08-29 Thread Michael Paquier
Avoid possible overflow with ltsGetFreeBlock() in logtape.c nFreeBlocks, defined as a long, stores the number of free blocks in a logical tape. ltsGetFreeBlock() has been using an int to store the value of nFreeBlocks, which could lead to overflows on platforms where long and int are not the same

pgsql: Tweak pg_promote() to report failures on kill() or postmaster fa

2023-08-28 Thread Michael Paquier
e existing CHECK_FOR_INTERRUPTS in the wait loop. False is only returned when the promotion is not completed within the specified time (60s by default). Author: Ashutosh Sharma Reviewed-by: Fujii Masao, Laurenz Albe, Michael Paquier Discussion: https://postgr.es/m/CAE9k0P=qtrwptl0t4j0fubrddjgst-0pvkd-i

pgsql: Fix some typos in wait_event_names.txt

2023-08-28 Thread Michael Paquier
Fix some typos in wait_event_names.txt Noticed in passing, while hacking on a different patch touching this area. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bb9002257b2211c213ad5989446d83a61c6446d3 Modified Files -- src/backend/utils/activity/wait_

pgsql: Tighten unit parsing in internal values

2023-08-27 Thread Michael Paquier
Tighten unit parsing in internal values Interval values now generate an error when the user has multiple consecutive units or a unit without a value. Previously, it was possible to specify multiple units consecutively which is contrary to what the documentation allows, so it was possible to finis

pgsql: Tighten handling of "ago" in interval values

2023-08-27 Thread Michael Paquier
Tighten handling of "ago" in interval values This commit Restrict the unit "ago" to only appear at the end of the interval. According to the documentation, a direction can only be defined at the end of an interval, but it was possible to define it in the middle of the string or define it multiple

pgsql: Remove dead code in DecodeInterval()

2023-08-27 Thread Michael Paquier
Remove dead code in DecodeInterval() This commit removes some dead code related to the unit type RESERV, whose last use has been removed from the unit lookup table used for intervals ("deltatktbl" in datetime.c) in 666cbae16da4. Before that, RESERV was used as an equivalent of "invalid", but that

Re: pgsql: Use "template" data directory in tests

2023-08-27 Thread Michael Paquier
Hi Andres, On Thu, Aug 24, 2023 at 10:09:20PM +, Andres Freund wrote: > Use "template" data directory in tests > > When running all (or just many) of our tests, a significant portion of both > CPU time and IO is spent running initdb. Most of those initdb runs don't > specify any options influ

pgsql: Show names of DEALLOCATE as constants in pg_stat_statements

2023-08-27 Thread Michael Paquier
n does not apply anymore. Like 638d42a3c520, this can be a huge advantage for monitoring where prepared statement names are randomly generated, preventing bloat in pg_stat_statements. A couple of tests are added to track the new behavior. Author: Dagfinn Ilmari Mannsåker, Michael Paquier Reviewed-

<    1   2   3   4   5   6   7   8   9   10   >