Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-10-22 Thread Alexander Korotkov
Hi, Pavel! Thank you for your review. On Tue, Oct 22, 2024 at 4:30 PM Pavel Borisov wrote: > On Tue, 22 Oct 2024 at 13:26, Alexander Korotkov wrote: >> >> On Wed, Oct 16, 2024 at 11:20 PM Alexander Korotkov >> wrote: >> > >> > On Wed, Oct 16, 2024 at 10:35 PM Peter Eisentraut >> > wrote: >>

pgsql: Add functions pg_set_attribute_stats() and pg_clear_attribute_st

2024-10-22 Thread Jeff Davis
Add functions pg_set_attribute_stats() and pg_clear_attribute_stats(). Enable manipulation of attribute statistics. Only superficial validation is performed, so it's possible to add nonsense, and it's up to the planner (or other users of statistics) to behave reasonably in that case. Bump catalog

pgsql: Change pg_*_relation_stats() functions to return type to void.

2024-10-22 Thread Jeff Davis
Change pg_*_relation_stats() functions to return type to void. These functions will either raise an ERROR or run to normal completion, so no return value is necessary. Bump catalog version. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=cbf8rnphutyhfi3kyzb9bydgx57hwk9rz2yp7s+om...

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: ecpg: Fix out-of-bound read in DecodeDateTime()

2024-10-22 Thread Michael Paquier
ecpg: Fix out-of-bound read in DecodeDateTime() It was possible for the code to read out-of-bound data from the "day_tab" table with some crafted input data. Let's treat these as invalid input as the month number is incorrect. A test is added to test this case with a check on the errno returned

pgsql: Improve parser's reporting of statement start locations.

2024-10-22 Thread Tom Lane
Improve parser's reporting of statement start locations. Up to now, the parser's reporting of a statement's stmt_location included any preceding whitespace or comments. This isn't really desirable but was done to avoid accounting honestly for nonterminals that reduce to empty. It causes problems

pgsql: Improve reporting of errors in extension script files.

2024-10-22 Thread Tom Lane
Improve reporting of errors in extension script files. Previously, CREATE/ALTER EXTENSION gave basically no useful context about errors reported while executing script files. I think the idea was that you could run the same commands manually to see the error, but that's often quite inconvenient. L

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-10-22 Thread Pavel Borisov
Hi, Alexander! On Tue, 22 Oct 2024 at 13:26, Alexander Korotkov wrote: > On Wed, Oct 16, 2024 at 11:20 PM Alexander Korotkov > wrote: > > > > On Wed, Oct 16, 2024 at 10:35 PM Peter Eisentraut > wrote: > > > On 02.09.24 01:55, Alexander Korotkov wrote: > > > > On Mon, Sep 2, 2024 at 2:28 AM Mic

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-10-22 Thread Pavel Borisov
Hi, Alexander! On Wed, 23 Oct 2024 at 00:12, Alexander Korotkov wrote: > Hi, Pavel! > > Thank you for your review. > > On Tue, Oct 22, 2024 at 4:30 PM Pavel Borisov > wrote: > > On Tue, 22 Oct 2024 at 13:26, Alexander Korotkov > wrote: > >> > >> On Wed, Oct 16, 2024 at 11:20 PM Alexander Korot

Re: pgsql: Add functions pg_set_attribute_stats() and pg_clear_attribute_st

2024-10-22 Thread Tom Lane
Jeff Davis writes: > Add functions pg_set_attribute_stats() and pg_clear_attribute_stats(). A couple of buildfarm animals, eg [1], are mildly unhappy: In file included from ../../../src/include/nodes/execnodes.h:37:0, from ../../../src/include/catalog/indexing.h:19,

pgsql: Make all Perl warnings fatal in 043_wal_replay_wait.pl

2024-10-22 Thread Alexander Korotkov
Make all Perl warnings fatal in 043_wal_replay_wait.pl This file was committed after c5385929593, but accidentally missed changing all warnings into fatal errors. Reported-by: Anton Voloshin Discussion: https://postgr.es/m/aa8a55d5-554a-4027-a491-1b0ca7c85f7a%40postgrespro.ru Branch -- mast

pgsql: ecpg: Refactor ecpg_log() to skip unnecessary calls to ECPGget_s

2024-10-22 Thread Fujii Masao
ecpg: Refactor ecpg_log() to skip unnecessary calls to ECPGget_sqlca(). Previously, ecpg_log() always called ECPGget_sqlca() to retrieve sqlca, even though it was only needed for debug logging. This commit updates ecpg_log() to call ECPGget_sqlca() only when debug logging is enabled. Author: Yuto

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-10-22 Thread Pavel Borisov
Fix a typo of myself: > Maybe refactoring for loop for assigning result variable and breaking a > loop instead of immediate return would look better and lead to natural call > of after the loop before returning. > Maybe refactoring for loop for assigning result variable and breaking a loop instea

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t