pgsql: Fix wrong logic in TransactionIdInRecentPast()

2024-02-09 Thread Alexander Korotkov
Fix wrong logic in TransactionIdInRecentPast() The TransactionIdInRecentPast() should return false for all the transactions older than TransamVariables->oldestClogXid. However, the function contains a bug in comparison FullTransactionId to TransactionID allowing full transactions between nextXid

pgsql: Fix wrong logic in TransactionIdInRecentPast()

2024-02-09 Thread Alexander Korotkov
Fix wrong logic in TransactionIdInRecentPast() The TransactionIdInRecentPast() should return false for all the transactions older than TransamVariables->oldestClogXid. However, the function contains a bug in comparison FullTransactionId to TransactionID allowing full transactions between nextXid

pgsql: Fix wrong logic in TransactionIdInRecentPast()

2024-02-09 Thread Alexander Korotkov
Fix wrong logic in TransactionIdInRecentPast() The TransactionIdInRecentPast() should return false for all the transactions older than TransamVariables->oldestClogXid. However, the function contains a bug in comparison FullTransactionId to TransactionID allowing full transactions between nextXid

pgsql: Fix wrong logic in TransactionIdInRecentPast()

2024-02-09 Thread Alexander Korotkov
Fix wrong logic in TransactionIdInRecentPast() The TransactionIdInRecentPast() should return false for all the transactions older than TransamVariables->oldestClogXid. However, the function contains a bug in comparison FullTransactionId to TransactionID allowing full transactions between nextXid

pgsql: Fix wrong logic in TransactionIdInRecentPast()

2024-02-09 Thread Alexander Korotkov
Fix wrong logic in TransactionIdInRecentPast() The TransactionIdInRecentPast() should return false for all the transactions older than TransamVariables->oldestClogXid. However, the function contains a bug in comparison FullTransactionId to TransactionID allowing full transactions between nextXid

pgsql: Fix usage of aggregate pathkeys in group_keys_reorder_by_pathkey

2024-02-09 Thread Alexander Korotkov
Fix usage of aggregate pathkeys in group_keys_reorder_by_pathkeys() group_keys_reorder_by_pathkeys() function searched for matching pathkeys within root->group_pathkeys. That could lead to picking an aggregate pathkey and using its pathkey->pk_eclass->ec_sortref as an argument of get_sortgroupref

pgsql: Refactor pipe_read_line to return the full line

2024-02-09 Thread Daniel Gustafsson
Refactor pipe_read_line to return the full line Commit 5b2f4afffe6 refactored find_other_exec() and in the process created pipe_read_line() into a static routine for reading a single line of output, aimed at reading version numbers. Commit a7e8ece41 later exposed it externally in order to read a

pgsql: Clean up Windows-specific mutex code in libpq and ecpglib.

2024-02-09 Thread Tom Lane
Clean up Windows-specific mutex code in libpq and ecpglib. Fix pthread-win32.h and pthread-win32.c to provide a more complete emulation of POSIX pthread mutexes: define PTHREAD_MUTEX_INITIALIZER and make sure that pthread_mutex_lock() can operate on a mutex object that's been initialized that way.

pgsql: Clean up Windows-specific mutex code in libpq and ecpglib.

2024-02-09 Thread Tom Lane
Clean up Windows-specific mutex code in libpq and ecpglib. Fix pthread-win32.h and pthread-win32.c to provide a more complete emulation of POSIX pthread mutexes: define PTHREAD_MUTEX_INITIALIZER and make sure that pthread_mutex_lock() can operate on a mutex object that's been initialized that way.

pgsql: Clean up Windows-specific mutex code in libpq and ecpglib.

2024-02-09 Thread Tom Lane
Clean up Windows-specific mutex code in libpq and ecpglib. Fix pthread-win32.h and pthread-win32.c to provide a more complete emulation of POSIX pthread mutexes: define PTHREAD_MUTEX_INITIALIZER and make sure that pthread_mutex_lock() can operate on a mutex object that's been initialized that way.

pgsql: Avoid concurrent calls to bindtextdomain().

2024-02-09 Thread Tom Lane
Avoid concurrent calls to bindtextdomain(). We previously supposed that it was okay for different threads to call bindtextdomain() concurrently (cf. commit 1f655fdc3). It now emerges that there's at least one gettext implementation in which that triggers an abort() crash, so let's stop doing that.

pgsql: Avoid concurrent calls to bindtextdomain().

2024-02-09 Thread Tom Lane
Avoid concurrent calls to bindtextdomain(). We previously supposed that it was okay for different threads to call bindtextdomain() concurrently (cf. commit 1f655fdc3). It now emerges that there's at least one gettext implementation in which that triggers an abort() crash, so let's stop doing that.

pgsql: Avoid concurrent calls to bindtextdomain().

2024-02-09 Thread Tom Lane
Avoid concurrent calls to bindtextdomain(). We previously supposed that it was okay for different threads to call bindtextdomain() concurrently (cf. commit 1f655fdc3). It now emerges that there's at least one gettext implementation in which that triggers an abort() crash, so let's stop doing that.

pgsql: Avoid concurrent calls to bindtextdomain().

2024-02-09 Thread Tom Lane
Avoid concurrent calls to bindtextdomain(). We previously supposed that it was okay for different threads to call bindtextdomain() concurrently (cf. commit 1f655fdc3). It now emerges that there's at least one gettext implementation in which that triggers an abort() crash, so let's stop doing that.

pgsql: Clean up Windows-specific mutex code in libpq and ecpglib.

2024-02-09 Thread Tom Lane
Clean up Windows-specific mutex code in libpq and ecpglib. Fix pthread-win32.h and pthread-win32.c to provide a more complete emulation of POSIX pthread mutexes: define PTHREAD_MUTEX_INITIALIZER and make sure that pthread_mutex_lock() can operate on a mutex object that's been initialized that way.

pgsql: Clean up Windows-specific mutex code in libpq and ecpglib.

2024-02-09 Thread Tom Lane
Clean up Windows-specific mutex code in libpq and ecpglib. Fix pthread-win32.h and pthread-win32.c to provide a more complete emulation of POSIX pthread mutexes: define PTHREAD_MUTEX_INITIALIZER and make sure that pthread_mutex_lock() can operate on a mutex object that's been initialized that way.

pgsql: Clean up Windows-specific mutex code in libpq and ecpglib.

2024-02-09 Thread Tom Lane
Clean up Windows-specific mutex code in libpq and ecpglib. Fix pthread-win32.h and pthread-win32.c to provide a more complete emulation of POSIX pthread mutexes: define PTHREAD_MUTEX_INITIALIZER and make sure that pthread_mutex_lock() can operate on a mutex object that's been initialized that way.

pgsql: Avoid concurrent calls to bindtextdomain().

2024-02-09 Thread Tom Lane
Avoid concurrent calls to bindtextdomain(). We previously supposed that it was okay for different threads to call bindtextdomain() concurrently (cf. commit 1f655fdc3). It now emerges that there's at least one gettext implementation in which that triggers an abort() crash, so let's stop doing that.

pgsql: Avoid concurrent calls to bindtextdomain().

2024-02-09 Thread Tom Lane
Avoid concurrent calls to bindtextdomain(). We previously supposed that it was okay for different threads to call bindtextdomain() concurrently (cf. commit 1f655fdc3). It now emerges that there's at least one gettext implementation in which that triggers an abort() crash, so let's stop doing that.

pgsql: Remove race condition in pg_get_expr().

2024-02-09 Thread Tom Lane
Remove race condition in pg_get_expr(). Since its introduction, pg_get_expr() has intended to silently return NULL if called with an invalid relation OID, as can happen when scanning the catalogs concurrently with relation drops. However, there is a race condition: we check validity of the OID at

pgsql: Remove race condition in pg_get_expr().

2024-02-09 Thread Tom Lane
Remove race condition in pg_get_expr(). Since its introduction, pg_get_expr() has intended to silently return NULL if called with an invalid relation OID, as can happen when scanning the catalogs concurrently with relation drops. However, there is a race condition: we check validity of the OID at

pgsql: Remove race condition in pg_get_expr().

2024-02-09 Thread Tom Lane
Remove race condition in pg_get_expr(). Since its introduction, pg_get_expr() has intended to silently return NULL if called with an invalid relation OID, as can happen when scanning the catalogs concurrently with relation drops. However, there is a race condition: we check validity of the OID at

pgsql: Remove race condition in pg_get_expr().

2024-02-09 Thread Tom Lane
Remove race condition in pg_get_expr(). Since its introduction, pg_get_expr() has intended to silently return NULL if called with an invalid relation OID, as can happen when scanning the catalogs concurrently with relation drops. However, there is a race condition: we check validity of the OID at

pgsql: Remove race condition in pg_get_expr().

2024-02-09 Thread Tom Lane
Remove race condition in pg_get_expr(). Since its introduction, pg_get_expr() has intended to silently return NULL if called with an invalid relation OID, as can happen when scanning the catalogs concurrently with relation drops. However, there is a race condition: we check validity of the OID at

pgsql: Remove race condition in pg_get_expr().

2024-02-09 Thread Tom Lane
Remove race condition in pg_get_expr(). Since its introduction, pg_get_expr() has intended to silently return NULL if called with an invalid relation OID, as can happen when scanning the catalogs concurrently with relation drops. However, there is a race condition: we check validity of the OID at