pgsql: Robustify find_base_rel and find_base_rel_ignore_join

2023-09-28 Thread David Rowley
Robustify find_base_rel and find_base_rel_ignore_join Improve find_base_rel() and find_base_rel_ignore_join() so that they raise an ERROR if they ever receive a negative relid value in non-cassert builds. If either of these functions had ever received a negative relid then they'd have attempted t

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: Fix btmarkpos/btrestrpos array key wraparound bug.

2023-09-28 Thread Peter Geoghegan
Fix btmarkpos/btrestrpos array key wraparound bug. nbtree's mark/restore processing failed to correctly handle an edge case involving array key advancement and related search-type scan key state. Scans with ScalarArrayScalarArrayOpExpr quals requiring mark/restore processing (for a merge join) cou

pgsql: Fix btmarkpos/btrestrpos array key wraparound bug.

2023-09-28 Thread Peter Geoghegan
Fix btmarkpos/btrestrpos array key wraparound bug. nbtree's mark/restore processing failed to correctly handle an edge case involving array key advancement and related search-type scan key state. Scans with ScalarArrayScalarArrayOpExpr quals requiring mark/restore processing (for a merge join) cou

pgsql: Fix btmarkpos/btrestrpos array key wraparound bug.

2023-09-28 Thread Peter Geoghegan
Fix btmarkpos/btrestrpos array key wraparound bug. nbtree's mark/restore processing failed to correctly handle an edge case involving array key advancement and related search-type scan key state. Scans with ScalarArrayScalarArrayOpExpr quals requiring mark/restore processing (for a merge join) cou

pgsql: Fix btmarkpos/btrestrpos array key wraparound bug.

2023-09-28 Thread Peter Geoghegan
Fix btmarkpos/btrestrpos array key wraparound bug. nbtree's mark/restore processing failed to correctly handle an edge case involving array key advancement and related search-type scan key state. Scans with ScalarArrayScalarArrayOpExpr quals requiring mark/restore processing (for a merge join) cou

pgsql: Fix btmarkpos/btrestrpos array key wraparound bug.

2023-09-28 Thread Peter Geoghegan
Fix btmarkpos/btrestrpos array key wraparound bug. nbtree's mark/restore processing failed to correctly handle an edge case involving array key advancement and related search-type scan key state. Scans with ScalarArrayScalarArrayOpExpr quals requiring mark/restore processing (for a merge join) cou

pgsql: Fix btmarkpos/btrestrpos array key wraparound bug.

2023-09-28 Thread Peter Geoghegan
Fix btmarkpos/btrestrpos array key wraparound bug. nbtree's mark/restore processing failed to correctly handle an edge case involving array key advancement and related search-type scan key state. Scans with ScalarArrayScalarArrayOpExpr quals requiring mark/restore processing (for a merge join) cou

pgsql: Fix btmarkpos/btrestrpos array key wraparound bug.

2023-09-28 Thread Peter Geoghegan
Fix btmarkpos/btrestrpos array key wraparound bug. nbtree's mark/restore processing failed to correctly handle an edge case involving array key advancement and related search-type scan key state. Scans with ScalarArrayScalarArrayOpExpr quals requiring mark/restore processing (for a merge join) cou

pgsql: Fix checking of index expressions in CompareIndexInfo().

2023-09-28 Thread Tom Lane
Fix checking of index expressions in CompareIndexInfo(). This code was sloppy about comparison of index columns that are expressions. It didn't reliably reject cases where one index has an expression where the other has a plain column, and it could index off the start of the attmap array, leading

pgsql: Fix checking of index expressions in CompareIndexInfo().

2023-09-28 Thread Tom Lane
Fix checking of index expressions in CompareIndexInfo(). This code was sloppy about comparison of index columns that are expressions. It didn't reliably reject cases where one index has an expression where the other has a plain column, and it could index off the start of the attmap array, leading

pgsql: Fix checking of index expressions in CompareIndexInfo().

2023-09-28 Thread Tom Lane
Fix checking of index expressions in CompareIndexInfo(). This code was sloppy about comparison of index columns that are expressions. It didn't reliably reject cases where one index has an expression where the other has a plain column, and it could index off the start of the attmap array, leading

pgsql: Fix checking of index expressions in CompareIndexInfo().

2023-09-28 Thread Tom Lane
Fix checking of index expressions in CompareIndexInfo(). This code was sloppy about comparison of index columns that are expressions. It didn't reliably reject cases where one index has an expression where the other has a plain column, and it could index off the start of the attmap array, leading

pgsql: Fix checking of index expressions in CompareIndexInfo().

2023-09-28 Thread Tom Lane
Fix checking of index expressions in CompareIndexInfo(). This code was sloppy about comparison of index columns that are expressions. It didn't reliably reject cases where one index has an expression where the other has a plain column, and it could index off the start of the attmap array, leading

pgsql: Fix checking of index expressions in CompareIndexInfo().

2023-09-28 Thread Tom Lane
Fix checking of index expressions in CompareIndexInfo(). This code was sloppy about comparison of index columns that are expressions. It didn't reliably reject cases where one index has an expression where the other has a plain column, and it could index off the start of the attmap array, leading

pgsql: Fix checking of index expressions in CompareIndexInfo().

2023-09-28 Thread Tom Lane
Fix checking of index expressions in CompareIndexInfo(). This code was sloppy about comparison of index columns that are expressions. It didn't reliably reject cases where one index has an expression where the other has a plain column, and it could index off the start of the attmap array, leading

pgsql: Return data from heap_page_prune via a struct.

2023-09-28 Thread Robert Haas
Return data from heap_page_prune via a struct. Previously, one of the values in the struct was returned as the return value, and another was returned via an output parameter. In preparation for returning more stuff, consolidate both values into a struct returned via an output parameter. Melanie P

pgsql: doc: Clarify where ereport severity levels are defined

2023-09-28 Thread Daniel Gustafsson
doc: Clarify where ereport severity levels are defined For a reader unfamiliar with the postgres code it might take some grepping to find where elevels are defined. This adds a reference to elog.h in the text like how SQLSTATE errorcodes are referenced to errcodes.h on the same page. Author: Kuwa

pgsql: Add missing TidRangePath handling in print_path()

2023-09-28 Thread David Rowley
Add missing TidRangePath handling in print_path() Tid Range scans were added back in bb437f995. That commit forgot to add handling for TidRangePaths in print_path(). Only people building with OPTIMIZER_DEBUG might have noticed this, which likely is the reason it's taken 4 years for anyone to not

pgsql: Add missing TidRangePath handling in print_path()

2023-09-28 Thread David Rowley
Add missing TidRangePath handling in print_path() Tid Range scans were added back in bb437f995. That commit forgot to add handling for TidRangePaths in print_path(). Only people building with OPTIMIZER_DEBUG might have noticed this, which likely is the reason it's taken 4 years for anyone to not

pgsql: Add missing TidRangePath handling in print_path()

2023-09-28 Thread David Rowley
Add missing TidRangePath handling in print_path() Tid Range scans were added back in bb437f995. That commit forgot to add handling for TidRangePaths in print_path(). Only people building with OPTIMIZER_DEBUG might have noticed this, which likely is the reason it's taken 4 years for anyone to not

pgsql: Add missing TidRangePath handling in print_path()

2023-09-28 Thread David Rowley
Add missing TidRangePath handling in print_path() Tid Range scans were added back in bb437f995. That commit forgot to add handling for TidRangePaths in print_path(). Only people building with OPTIMIZER_DEBUG might have noticed this, which likely is the reason it's taken 4 years for anyone to not

pgsql: Fix typo in src/backend/access/transam/README.

2023-09-28 Thread Etsuro Fujita
Fix typo in src/backend/access/transam/README. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c68f78538f93803b5c4f879da12918762eb43482 Modified Files -- src/backend/access/transam/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Fix typo in src/backend/access/transam/README.

2023-09-28 Thread Etsuro Fujita
Fix typo in src/backend/access/transam/README. Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/0db39e633812e8bda24067904ee8bc262e9eae25 Modified Files -- src/backend/access/transam/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Fix typo in src/backend/access/transam/README.

2023-09-28 Thread Etsuro Fujita
Fix typo in src/backend/access/transam/README. Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/8bdfc53be48ae99109a05df1dfd203d35207733f Modified Files -- src/backend/access/transam/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Fix typo in src/backend/access/transam/README.

2023-09-28 Thread Etsuro Fujita
Fix typo in src/backend/access/transam/README. Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/c33d42d2e95d7994582ea3b811826088b76ce4e2 Modified Files -- src/backend/access/transam/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: doc: Improve documentation about pg_resetwal -f option

2023-09-28 Thread Peter Eisentraut
doc: Improve documentation about pg_resetwal -f option Reviewed-by: Aleksander Alekseev Discussion: https://www.postgresql.org/message-id/flat/0f3ab4a1-ae80-56e8-3426-6b4a02507...@eisentraut.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5f1b00e64aee58a83558b

pgsql: pg_resetwal: Use frontend logging API

2023-09-28 Thread Peter Eisentraut
pg_resetwal: Use frontend logging API This now causes error messages related to the lack of the -f option to appear on standard error rather than standard output. Reviewed-by: Aleksander Alekseev Discussion: https://www.postgresql.org/message-id/flat/0f3ab4a1-ae80-56e8-3426-6b4a02507...@eisentr

pgsql: pg_resetwal: Regroup --help output

2023-09-28 Thread Peter Eisentraut
pg_resetwal: Regroup --help output Put the options to modify the control values into a separate group. This matches the outline of the man page. Reviewed-by: Aleksander Alekseev Discussion: https://www.postgresql.org/message-id/flat/0f3ab4a1-ae80-56e8-3426-6b4a02507...@eisentraut.org Branch --

pgsql: pg_resetwal: Improve error with wrong/missing data directory

2023-09-28 Thread Peter Eisentraut
pg_resetwal: Improve error with wrong/missing data directory Run chdir() before permission check to get a less confusing error message if the specified data directory does not exist. Reviewed-by: Aleksander Alekseev Discussion: https://www.postgresql.org/message-id/flat/0f3ab4a1-ae80-56e8-3426-

pgsql: pg_resetwal: Update an obsolete comment

2023-09-28 Thread Peter Eisentraut
pg_resetwal: Update an obsolete comment The comment claimed that pg_resetwal updates the pg_control file if it is of an old version. This has apparently never been true. Also, in c3c09be34b, another comment was added elsewhere that this currently does not happen. So this comment is wrong and re