pgsql: Deduplicate choice of horizon for a relation procarray.c.

2021-07-24 Thread Andres Freund
Deduplicate choice of horizon for a relation procarray.c. 5a1e1d83022 was a minimal bug fix for dc7420c2c92. To avoid future bugs of that kind, deduplicate the choice of a relation's horizon into a new helper, GlobalVisHorizonKindForRel(). As the code in question was only introduced in dc7420c2c9

pgsql: Deduplicate choice of horizon for a relation procarray.c.

2021-07-24 Thread Andres Freund
Deduplicate choice of horizon for a relation procarray.c. 5a1e1d83022 was a minimal bug fix for dc7420c2c92. To avoid future bugs of that kind, deduplicate the choice of a relation's horizon into a new helper, GlobalVisHorizonKindForRel(). As the code in question was only introduced in dc7420c2c9

pgsql: Make the standby server promptly handle interrupt signals.

2021-07-24 Thread Fujii Masao
Make the standby server promptly handle interrupt signals. This commit changes the startup process in the standby server so that it handles the interrupt signals after waiting for wal_retrieve_retry_interval on the latch and resetting it, before entering another wait on the latch. This change caus

pgsql: Make the standby server promptly handle interrupt signals.

2021-07-24 Thread Fujii Masao
Make the standby server promptly handle interrupt signals. This commit changes the startup process in the standby server so that it handles the interrupt signals after waiting for wal_retrieve_retry_interval on the latch and resetting it, before entering another wait on the latch. This change caus

pgsql: Make the standby server promptly handle interrupt signals.

2021-07-24 Thread Fujii Masao
Make the standby server promptly handle interrupt signals. This commit changes the startup process in the standby server so that it handles the interrupt signals after waiting for wal_retrieve_retry_interval on the latch and resetting it, before entering another wait on the latch. This change caus

pgsql: Make the standby server promptly handle interrupt signals.

2021-07-24 Thread Fujii Masao
Make the standby server promptly handle interrupt signals. This commit changes the startup process in the standby server so that it handles the interrupt signals after waiting for wal_retrieve_retry_interval on the latch and resetting it, before entering another wait on the latch. This change caus

pgsql: Make the standby server promptly handle interrupt signals.

2021-07-24 Thread Fujii Masao
Make the standby server promptly handle interrupt signals. This commit changes the startup process in the standby server so that it handles the interrupt signals after waiting for wal_retrieve_retry_interval on the latch and resetting it, before entering another wait on the latch. This change caus

pgsql: Fix check for conflicting session- vs transaction-level locks.

2021-07-24 Thread Tom Lane
Fix check for conflicting session- vs transaction-level locks. We have an implementation restriction that PREPARE TRANSACTION can't handle cases where both session-lifespan and transaction-lifespan locks are held on the same lockable object. (That's because we'd otherwise need to acquire a new PR

pgsql: Fix check for conflicting session- vs transaction-level locks.

2021-07-24 Thread Tom Lane
Fix check for conflicting session- vs transaction-level locks. We have an implementation restriction that PREPARE TRANSACTION can't handle cases where both session-lifespan and transaction-lifespan locks are held on the same lockable object. (That's because we'd otherwise need to acquire a new PR

pgsql: Fix check for conflicting session- vs transaction-level locks.

2021-07-24 Thread Tom Lane
Fix check for conflicting session- vs transaction-level locks. We have an implementation restriction that PREPARE TRANSACTION can't handle cases where both session-lifespan and transaction-lifespan locks are held on the same lockable object. (That's because we'd otherwise need to acquire a new PR

pgsql: Fix check for conflicting session- vs transaction-level locks.

2021-07-24 Thread Tom Lane
Fix check for conflicting session- vs transaction-level locks. We have an implementation restriction that PREPARE TRANSACTION can't handle cases where both session-lifespan and transaction-lifespan locks are held on the same lockable object. (That's because we'd otherwise need to acquire a new PR

pgsql: Fix check for conflicting session- vs transaction-level locks.

2021-07-24 Thread Tom Lane
Fix check for conflicting session- vs transaction-level locks. We have an implementation restriction that PREPARE TRANSACTION can't handle cases where both session-lifespan and transaction-lifespan locks are held on the same lockable object. (That's because we'd otherwise need to acquire a new PR

pgsql: Fix check for conflicting session- vs transaction-level locks.

2021-07-24 Thread Tom Lane
Fix check for conflicting session- vs transaction-level locks. We have an implementation restriction that PREPARE TRANSACTION can't handle cases where both session-lifespan and transaction-lifespan locks are held on the same lockable object. (That's because we'd otherwise need to acquire a new PR

pgsql: Fix check for conflicting session- vs transaction-level locks.

2021-07-24 Thread Tom Lane
Fix check for conflicting session- vs transaction-level locks. We have an implementation restriction that PREPARE TRANSACTION can't handle cases where both session-lifespan and transaction-lifespan locks are held on the same lockable object. (That's because we'd otherwise need to acquire a new PR

pgsql: Make printf("%s", NULL) print "(null)" instead of crashing.

2021-07-24 Thread Tom Lane
Make printf("%s", NULL) print "(null)" instead of crashing. We previously took a hard-line attitude that callers should never print a null string pointer, and doing so is worthy of an assertion failure or crash. However, we've long since flushed out any easy-to-find bugs of that nature. What rem

pgsql: Make printf("%s", NULL) print "(null)" instead of crashing.

2021-07-24 Thread Tom Lane
Make printf("%s", NULL) print "(null)" instead of crashing. We previously took a hard-line attitude that callers should never print a null string pointer, and doing so is worthy of an assertion failure or crash. However, we've long since flushed out any easy-to-find bugs of that nature. What rem

pgsql: Make printf("%s", NULL) print "(null)" instead of crashing.

2021-07-24 Thread Tom Lane
Make printf("%s", NULL) print "(null)" instead of crashing. We previously took a hard-line attitude that callers should never print a null string pointer, and doing so is worthy of an assertion failure or crash. However, we've long since flushed out any easy-to-find bugs of that nature. What rem

pgsql: Make printf("%s", NULL) print "(null)" instead of crashing.

2021-07-24 Thread Tom Lane
Make printf("%s", NULL) print "(null)" instead of crashing. We previously took a hard-line attitude that callers should never print a null string pointer, and doing so is worthy of an assertion failure or crash. However, we've long since flushed out any easy-to-find bugs of that nature. What rem

pgsql: Make printf("%s", NULL) print "(null)" instead of crashing.

2021-07-24 Thread Tom Lane
Make printf("%s", NULL) print "(null)" instead of crashing. We previously took a hard-line attitude that callers should never print a null string pointer, and doing so is worthy of an assertion failure or crash. However, we've long since flushed out any easy-to-find bugs of that nature. What rem

pgsql: Make printf("%s", NULL) print "(null)" instead of crashing.

2021-07-24 Thread Tom Lane
Make printf("%s", NULL) print "(null)" instead of crashing. We previously took a hard-line attitude that callers should never print a null string pointer, and doing so is worthy of an assertion failure or crash. However, we've long since flushed out any easy-to-find bugs of that nature. What rem

pgsql: Make printf("%s", NULL) print "(null)" instead of crashing.

2021-07-24 Thread Tom Lane
Make printf("%s", NULL) print "(null)" instead of crashing. We previously took a hard-line attitude that callers should never print a null string pointer, and doing so is worthy of an assertion failure or crash. However, we've long since flushed out any easy-to-find bugs of that nature. What rem

pgsql: Remove configure-time thread safety checking (thread_test.c).

2021-07-24 Thread Tom Lane
Remove configure-time thread safety checking (thread_test.c). This testing was useful when it was written, nigh twenty years ago, but it seems fairly pointless for any platform built in the last dozen or more years. (Compare also the comments at 8a2121185.) Also we now have reports that the test

pgsql: Remove configure-time thread safety checking (thread_test.c).

2021-07-24 Thread Tom Lane
Remove configure-time thread safety checking (thread_test.c). This testing was useful when it was written, nigh twenty years ago, but it seems fairly pointless for any platform built in the last dozen or more years. (Compare also the comments at 8a2121185.) Also we now have reports that the test

pgsql: Fix failure of some headers to compile "standalone".

2021-07-24 Thread Tom Lane
Fix failure of some headers to compile "standalone". Recently-added references to ParseState weren't covered by #include references, creating unwanted ordering dependencies for users of these headers. Oversight in commit 2bfb50b3d. Per headerscheck/cpluspluscheck. Branch -- master Details

pgsql: Add missing header declarations for pg_basebackup and pg_{dump,r

2021-07-24 Thread Michael Paquier
Add missing header declarations for pg_basebackup and pg_{dump,restore} This fixes two compilation failures caused by 6f164e6. Interesting to see that missing dies not fail in Linux or even Windows. On MacOS, it fails, though. Per various buildfarm members. Branch -- master Details -

pgsql: Unify parsing logic for command-line integer options

2021-07-24 Thread Michael Paquier
Unify parsing logic for command-line integer options Most of the integer options for command-line binaries now make use of a single routine able to do the job, fixing issues with the detection of sloppy values caused for example by the use of atoi(), that fails on strings beginning with numerical