pgsql: Fix inconsistent comments for some function declarations in head

2022-08-04 Thread Michael Paquier
Fix inconsistent comments for some function declarations in headers Some of the headers list a couple of function prototypes located in a different file than what is referred to. This fixes a couple of places where this inconsistency exists. Author: Richard Guo Discussion: https://postgr.es/m/c

pgsql: Clarify DROP EXTENSION docs regarding explicitly dependent routi

2022-08-04 Thread John Naylor
Clarify DROP EXTENSION docs regarding explicitly dependent routines Per suggestion from Robert Haas Backpatch to v14 Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZ1QvHquYHLkMy1oHKqz4-E7QQctj6e0ocq_GP1B5%2B9bA%40mail.gmail.com Branch -- master Details --- https://git.post

pgsql: Clarify DROP EXTENSION docs regarding explicitly dependent routi

2022-08-04 Thread John Naylor
Clarify DROP EXTENSION docs regarding explicitly dependent routines Per suggestion from Robert Haas Backpatch to v14 Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZ1QvHquYHLkMy1oHKqz4-E7QQctj6e0ocq_GP1B5%2B9bA%40mail.gmail.com Branch -- REL_15_STABLE Details --- https://g

pgsql: Clarify DROP EXTENSION docs regarding explicitly dependent routi

2022-08-04 Thread John Naylor
Clarify DROP EXTENSION docs regarding explicitly dependent routines Per suggestion from Robert Haas Backpatch to v14 Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZ1QvHquYHLkMy1oHKqz4-E7QQctj6e0ocq_GP1B5%2B9bA%40mail.gmail.com Branch -- REL_14_STABLE Details --- https://g

pgsql: Fix assorted doc typos

2022-08-04 Thread John Naylor
Fix assorted doc typos Erik Rijkers and Justin Pryzby Backpatch to v14 Discussion: https://www.postgresql.org/message-id/b79bfeff-d0e3-29a3-2576-0e325848dede%40xs4all.nl Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/9f08803828d7dc9691e773f5bec4eed21f5ff520 Mod

pgsql: Fix assorted doc typos

2022-08-04 Thread John Naylor
Fix assorted doc typos Erik Rijkers and Justin Pryzby Backpatch to v14 Discussion: https://www.postgresql.org/message-id/b79bfeff-d0e3-29a3-2576-0e325848dede%40xs4all.nl Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/b25566ab3c6536040df4df3ad99dd69c812215

pgsql: Fix assorted doc typos

2022-08-04 Thread John Naylor
Fix assorted doc typos Erik Rijkers and Justin Pryzby Backpatch to v14 Discussion: https://www.postgresql.org/message-id/b79bfeff-d0e3-29a3-2576-0e325848dede%40xs4all.nl Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/120e159b7d93fa36b94ded8a51fe4e619e1261

pgsql: Fix formatting and comment typos

2022-08-04 Thread John Naylor
Fix formatting and comment typos Justin Pryzby Discussion: https://www.postgresql.org/message-id/20220801181136.GJ15006%40telsasoft.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bcabbfc6a94bb1d59e380f1bcb7cd5da8338cd11 Modified Files -- src/back

pgsql: Rephrase comments to make them clearer

2022-08-04 Thread Daniel Gustafsson
Rephrase comments to make them clearer The use of "we" when referring to the active backend might be misunderstood, so rephrase to make it clearer who is performing the actions discussed in the comment. Author: Junwang Zhao Reviewed-by: Erikjan Rijkers Reviewed-by: Robert Treat Reviewed-by: To

pgsql: Add proper regression test for the recent SRFs-in-pathkeys probl

2022-08-04 Thread Tom Lane
Add proper regression test for the recent SRFs-in-pathkeys problem. Remove the test case added by commit fac1b470a, which never actually worked to expose the problem it claimed to test. Replace it with a case that does expose the problem, and also covers the SRF-not- at-the-top deficiency repaire

pgsql: Add proper regression test for the recent SRFs-in-pathkeys probl

2022-08-04 Thread Tom Lane
Add proper regression test for the recent SRFs-in-pathkeys problem. Remove the test case added by commit fac1b470a, which never actually worked to expose the problem it claimed to test. Replace it with a case that does expose the problem, and also covers the SRF-not- at-the-top deficiency repaire

pgsql: Add proper regression test for the recent SRFs-in-pathkeys probl

2022-08-04 Thread Tom Lane
Add proper regression test for the recent SRFs-in-pathkeys problem. Remove the test case added by commit fac1b470a, which never actually worked to expose the problem it claimed to test. Replace it with a case that does expose the problem, and also covers the SRF-not- at-the-top deficiency repaire

pgsql: Add proper regression test for the recent SRFs-in-pathkeys probl

2022-08-04 Thread Tom Lane
Add proper regression test for the recent SRFs-in-pathkeys problem. Remove the test case added by commit fac1b470a, which never actually worked to expose the problem it claimed to test. Replace it with a case that does expose the problem, and also covers the SRF-not- at-the-top deficiency repaire

pgsql: Fix check_exclusion_or_unique_constraint for UNIQUE NULLS NOT DI

2022-08-04 Thread Tom Lane
Fix check_exclusion_or_unique_constraint for UNIQUE NULLS NOT DISTINCT. Adjusting this function was overlooked in commit 94aa7cc5f. The only visible symptom (so far) is that INSERT ... ON CONFLICT could go into an endless loop when inserting a null that has a conflict. Richard Guo and Tom Lane,

pgsql: Fix check_exclusion_or_unique_constraint for UNIQUE NULLS NOT DI

2022-08-04 Thread Tom Lane
Fix check_exclusion_or_unique_constraint for UNIQUE NULLS NOT DISTINCT. Adjusting this function was overlooked in commit 94aa7cc5f. The only visible symptom (so far) is that INSERT ... ON CONFLICT could go into an endless loop when inserting a null that has a conflict. Richard Guo and Tom Lane,

pgsql: Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion l

2022-08-04 Thread Tom Lane
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop. Ordinarily the functions called in this loop ought to have plenty of CFIs themselves; but we've now seen a case where no such CFI is reached, making the loop uninterruptible. Even though that's from a recently-introduced bug, it

pgsql: Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion l

2022-08-04 Thread Tom Lane
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop. Ordinarily the functions called in this loop ought to have plenty of CFIs themselves; but we've now seen a case where no such CFI is reached, making the loop uninterruptible. Even though that's from a recently-introduced bug, it

pgsql: Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion l

2022-08-04 Thread Tom Lane
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop. Ordinarily the functions called in this loop ought to have plenty of CFIs themselves; but we've now seen a case where no such CFI is reached, making the loop uninterruptible. Even though that's from a recently-introduced bug, it

pgsql: Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion l

2022-08-04 Thread Tom Lane
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop. Ordinarily the functions called in this loop ought to have plenty of CFIs themselves; but we've now seen a case where no such CFI is reached, making the loop uninterruptible. Even though that's from a recently-introduced bug, it

pgsql: Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion l

2022-08-04 Thread Tom Lane
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop. Ordinarily the functions called in this loop ought to have plenty of CFIs themselves; but we've now seen a case where no such CFI is reached, making the loop uninterruptible. Even though that's from a recently-introduced bug, it

pgsql: Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion l

2022-08-04 Thread Tom Lane
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop. Ordinarily the functions called in this loop ought to have plenty of CFIs themselves; but we've now seen a case where no such CFI is reached, making the loop uninterruptible. Even though that's from a recently-introduced bug, it

pgsql: Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion l

2022-08-04 Thread Tom Lane
Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop. Ordinarily the functions called in this loop ought to have plenty of CFIs themselves; but we've now seen a case where no such CFI is reached, making the loop uninterruptible. Even though that's from a recently-introduced bug, it

pgsql: Revert recent changes to 002_pg_upgrade.pl.

2022-08-04 Thread Robert Haas
Revert recent changes to 002_pg_upgrade.pl. The test is proving to be unreliable in the buildfarm, and we neither agree on how best to fix it nor have time to do so before the upcoming release. So for now, put things back to the way they were before commit d498e052b4b84ae21b3b68d5b3fda6ead65d1d4d.

pgsql: Revert recent changes to 002_pg_upgrade.pl.

2022-08-04 Thread Robert Haas
Revert recent changes to 002_pg_upgrade.pl. The test is proving to be unreliable in the buildfarm, and we neither agree on how best to fix it nor have time to do so before the upcoming release. So for now, put things back to the way they were before commit d498e052b4b84ae21b3b68d5b3fda6ead65d1d4d.

pgsql: Remove configure probe for link.

2022-08-04 Thread Thomas Munro
Remove configure probe for link. link() is in SUSv2 and all targeted Unix systems have it. We have replacement code for Windows that doesn't require a configure probe. Since only Windows needs it, rename src/port/link.c to win32link.c like other similar things. There is no need for a vestigial H

pgsql: Remove dead setenv, unsetenv replacement code.

2022-08-04 Thread Thomas Munro
Remove dead setenv, unsetenv replacement code. setenv() and unsetenv() are in SUSv3 and targeted Unix systems have them. We still need special code for these on Windows, but that doesn't require a configure probe. This marks the first time we require a SUSv3 (POSIX.1-2001) facility (rather than

pgsql: Remove configure probes for poll and poll.h.

2022-08-04 Thread Thomas Munro
Remove configure probes for poll and poll.h. poll() and are in SUSv2 and all targeted Unix systems have them. Retain HAVE_POLL and HAVE_POLL_H macros for readability. There's an error in latch.c that is now unreachable (since we always have one of WIN32 or HAVE_POLL defined), but that falls out

pgsql: Remove configure probe for dlopen, and refactor.

2022-08-04 Thread Thomas Munro
Remove configure probe for dlopen, and refactor. dlopen() is in SUSv2 and all targeted Unix systems have it. We still need replacement functions for Windows, but we don't need a configure probe for that. Since it's no longer needed by other operating systems, rename dlopen.c to win32dlopen.c and

pgsql: Remove configure probe and related tests for getrlimit.

2022-08-04 Thread Thomas Munro
Remove configure probe and related tests for getrlimit. getrlimit() is in SUSv2 and all targeted systems have it. Windows doesn't have it. We could just use #ifndef WIN32, but for a little more explanation about why we're making things conditional, let's retain the HAVE_GETRLIMIT macro. It's de

pgsql: Remove configure probe for setsid.

2022-08-04 Thread Thomas Munro
Remove configure probe for setsid. setsid() is in SUSv2 and all targeted Unix systems have it. Retain a HAVE_SETSID macro, defined on Unix only. That's easier to understand than !defined(WIN32), for the optional code it governs. Reviewed-by: Tom Lane Reviewed-by: Andres Freund Discussion: ht

pgsql: Remove dead pread and pwrite replacement code.

2022-08-04 Thread Thomas Munro
Remove dead pread and pwrite replacement code. pread() and pwrite() are in SUSv2, and all targeted Unix systems have them. Previously, we defined pg_pread and pg_pwrite to emulate these function with lseek() on old Unixen. The names with a pg_ prefix were a reminder of a portability hazard: they

pgsql: Remove configure probe for shm_open.

2022-08-04 Thread Thomas Munro
Remove configure probe for shm_open. shm_open() is in SUSv2 and all targeted Unix systems have it. We retain a HAVE_SHM_OPEN macro, because it's clearer to readers than something like !defined(WIN32). Reviewed-by: Tom Lane Reviewed-by: Andres Freund Discussion: https://postgr.es/m/CA+hUKGJ3LH

pgsql: Remove configure probes for symlink/readlink, and dead code.

2022-08-04 Thread Thomas Munro
Remove configure probes for symlink/readlink, and dead code. symlink() and readlink() are in SUSv2 and all targeted Unix systems have them. We have partial emulation on Windows. Code that raised runtime errors on systems without it has been dead for years, so we can remove that and also referenc

pgsql: Fix failure to set correct operator in window run condition

2022-08-04 Thread David Rowley
Fix failure to set correct operator in window run condition This was a simple omission in 9d9c02ccd where the code didn't correctly set the operator to use in the run condition OpExpr when the window function was both monotonically increasing and decreasing. Bug discovered by Julien Roze, althoug

pgsql: Fix failure to set correct operator in window run condition

2022-08-04 Thread David Rowley
Fix failure to set correct operator in window run condition This was a simple omission in 9d9c02ccd where the code didn't correctly set the operator to use in the run condition OpExpr when the window function was both monotonically increasing and decreasing. Bug discovered by Julien Roze, althoug

pgsql: Use hba_file/ident_file GUCs rather than pg_hba.conf/pg_ident.co

2022-08-04 Thread Michael Paquier
Use hba_file/ident_file GUCs rather than pg_hba.conf/pg_ident.conf in logs This is particularly useful when log_min_messages is set to FATAL, so as one can know which file was not getting loaded whether hba_file or ident_file are set to some non-default values. If using the default values of thes

pgsql: Make consistent a couple of log messages when parsing HBA files

2022-08-04 Thread Michael Paquier
Make consistent a couple of log messages when parsing HBA files This commit adjusts two log messages: - When a field in pg_ident.conf is not populated, report the line of the configuration file in an error context message instead of the main entry. - When parsing pg_ident.conf and finding an inval

pgsql: Simplify replacement code for preadv and pwritev.

2022-08-04 Thread Thomas Munro
Simplify replacement code for preadv and pwritev. preadv() and pwritev() are not standardized by POSIX, but appeared in NetBSD in 1999 and were adopted by at least OpenBSD, FreeBSD, DragonFlyBSD, Linux, AIX, illumos and macOS. We don't use them much yet, but an active proposal uses them heavily.

pgsql: Fix nbtree maximum item size macro.

2022-08-04 Thread Peter Geoghegan
Fix nbtree maximum item size macro. Commit dd299df8189, which made heap TID a tiebreaker nbtree index column, introduced new rules on page space management to make suffix truncation safe for v4+ indexes. New pivot tuples (generated by suffix truncation during leaf page splits) sometimes require d

pgsql: Remove configure probe for clock_gettime.

2022-08-04 Thread Thomas Munro
Remove configure probe for clock_gettime. clock_gettime() is in SUSv2 and all targeted Unix systems have it. Remove a chunk of fallback code for old Unix is no longer reachable on modern systems, and untested as of the retirement of build farm animal prairiedog. There is no need to retain a HAVE_

pgsql: Remove configure probe for fdatasync.

2022-08-04 Thread Thomas Munro
Remove configure probe for fdatasync. fdatasync() is in SUSv2, and all targeted Unix systems have it. We have a replacement function for Windows. We retain the probe for the function declaration, which allows us to supply the mysteriously missing declaration for macOS, and also for Windows. No