Re: pgsql: Further further fix pg_upgrade crossversion test for adminpack.

2024-03-08 Thread Jeff Davis
On Mon, 2024-03-04 at 18:10 +, Tom Lane wrote: > Further further fix pg_upgrade crossversion test for adminpack. Ever since this commit the cross-version upgrade test is failing (for me, at least) with: # Running: psql -X -v ON_ERROR_STOP=1 -c drop database if exists

pgsql: Document units of "timeout" in ConditionVariableTimedSleep()

2024-03-08 Thread Michael Paquier
Document units of "timeout" in ConditionVariableTimedSleep() The timeout is passed down to WaitLatch() as milliseconds. Author: Shveta Malik Discussion: https://postgr.es/m/CAJpy0uC=xibqd1wapgyyvoiytap6uljaakld867zzxqu9ty...@mail.gmail.com Branch -- master Details ---

Re: pgsql: Unicode case mapping tables and functions.

2024-03-08 Thread Jeff Davis
On Fri, 2024-03-08 at 10:24 +0200, Heikki Linnakangas wrote: > On 07/03/2024 21:18, Jeff Davis wrote: > > Unicode case mapping tables and functions. > > With -Wtype-limits, I'm seeing this warning: Thank you, fixed. Somehow I lost that flag from my script. Can you please add some recommended

pgsql: Fix type signedness error in commit 5c40364dd6.

2024-03-08 Thread Jeff Davis
Fix type signedness error in commit 5c40364dd6. Use ssize_t instead of size_t. Discussion: https://postgr.es/m/b20d6d97-7338-48ea-ba33-837a1c8ef...@iki.fi Reported-by: Heikki Linnakangas Branch -- master Details ---

pgsql: Replace perror with custom postgres logging

2024-03-08 Thread Daniel Gustafsson
Replace perror with custom postgres logging perror() is not used in postgres anymore out of policy, this replaces the final callsites with the custom postgres logging framework. Reviewed-by: Tom Lane Reviewed-by: Peter Eisentraut Discussion:

pgsql: Fix errorhandling for reading from a pipe

2024-03-08 Thread Daniel Gustafsson
Fix errorhandling for reading from a pipe When reading a line from a pipe failed on no data being read, the errorhandling was erroneously logging with %m even thoug no error description is available for %m to print. This flaw accidentally introduced in 5c7038d70bb. Reported-by: Peter Eisentraut

pgsql: Improve WIN32 waiting logic in psql's \watch command.

2024-03-08 Thread Tom Lane
Improve WIN32 waiting logic in psql's \watch command. do_watch had some leftover logic for enabling siglongjmp out of waiting for input. That's never done anything on Windows (cf. psql_cancel_callback), and do_watch no longer relies on it for non-Windows, so let's drop it. Also, when the user

pgsql: Admit deferrable PKs into rd_pkindex, but flag them as such

2024-03-08 Thread Alvaro Herrera
Admit deferrable PKs into rd_pkindex, but flag them as such ... and in particular don't return them as replica identity. The motivation for this change is letting the primary keys be seen by code that derives NOT NULL constraints from them, when creating inheritance children; before this change,

pgsql: Avoid stack overflow in ShowTransactionStateRec()

2024-03-08 Thread Alexander Korotkov
Avoid stack overflow in ShowTransactionStateRec() The function recurses, but didn't perform stack-depth checks. It's just a debugging aid, so instead of the usual check_stack_depth() call, stop the printing if we'd risk stack overflow. Here's an example of how to test this: (n=100;

pgsql: Avoid recursion in MemoryContext functions

2024-03-08 Thread Alexander Korotkov
Avoid recursion in MemoryContext functions You might run out of stack space with recursion, which is not nice in functions that might be used e.g. at cleanup after transaction abort. MemoryContext contains pointer to parent and siblings, so we can traverse a tree of contexts iteratively, without

pgsql: Turn tail recursion into iteration in CommitTransactionCommand()

2024-03-08 Thread Alexander Korotkov
Turn tail recursion into iteration in CommitTransactionCommand() Usually the compiler will optimize away the tail recursion anyway, but if it doesn't, you can drive the function into stack overflow. For example: (n=100; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT s$i;";

Re: pgsql: Unicode case mapping tables and functions.

2024-03-08 Thread Heikki Linnakangas
On 07/03/2024 21:18, Jeff Davis wrote: Unicode case mapping tables and functions. With -Wtype-limits, I'm seeing this warning: unicode_case.c: In function ‘convert_case’: unicode_case.c:107:47: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits] 107 |