pgsql: Improve some error messages with invalid indexes for REINDEX CON

2023-12-06 Thread Michael Paquier
Improve some error messages with invalid indexes for REINDEX CONCURRENTLY An invalid index is skipped when doing REINDEX CONCURRENTLY at table level, with INDEX_CORRUPTED used as errcode. This is confusing, because an invalid index could exist after an interruption. The errcode is switched to OB

pgsql: Fix issues in binary_upgrade_logical_slot_has_caught_up().

2023-12-06 Thread Amit Kapila
Fix issues in binary_upgrade_logical_slot_has_caught_up(). The commit 29d0a77fa6 labelled binary_upgrade_logical_slot_has_caught_up() as a non-strict function to allow providing a better error message to callers in case the passed slot_name is NULL. On further discussion, it seems that it is not h

pgsql: Fix assertion failure with REINDEX and event triggers

2023-12-06 Thread Michael Paquier
Fix assertion failure with REINDEX and event triggers A REINDEX CONCURRENTLY run on a table with no indexes would always pop the topmost snapshot from the active snapshot stack, making the snapshot handling inconsistent between the multiple-relation and single-relation cases. This commit slightly

pgsql: Suppress -Wunused-result warning about write().

2023-12-06 Thread Nathan Bossart
Suppress -Wunused-result warning about write(). pg_test_fsync's signal_cleanup() intentionally ignores the write() result since there's not much we could do about it, but certain compilers make that harder than it ought to be. This was missed in commit 52e98d4502. Reviewed-by: Tristan Partin, Pe

pgsql: Use signal-safe functions in signal handler

2023-12-06 Thread Peter Eisentraut
Use signal-safe functions in signal handler According to signal-safety(7), exit(3) and puts(3) are not safe to call in a signal handler. Author: Tristan Partin Discussion: https://www.postgresql.org/message-id/flat/CTVDKVZCCVSY.1XQ87UL50KQRD%40gonk Branch -- master Details --- https:/