pgsql: Move any code specific to log_destination=csvlog to its own file

2022-01-11 Thread Michael Paquier
Move any code specific to log_destination=csvlog to its own file The recent refactoring done in ac7c807 makes this move possible and simple, as this just moves some code around. This reduces the size of elog.c by 7%. Author: Michael Paquier, Sehrope Sarkuni Reviewed-by: Nathan Bossart Discussion

pgsql: Refactor set of routines specific to elog.c

2022-01-11 Thread Michael Paquier
Refactor set of routines specific to elog.c This refactors the following routines and facilities coming from elog.c, to ease their use across multiple log destinations: - Start timestamp, including its reset, to store when a process has been started. - The log timestamp, associated to an entry (th

pgsql: Fix comment related to pg_cryptohash_error()

2022-01-11 Thread Michael Paquier
Fix comment related to pg_cryptohash_error() One of the comments introduced in b69aba7 was worded a bit weirdly, so improve it. Reported-by: Sergey Shinderuk Discussion: https://postgr.es/m/71b9a5d2-a3bf-83bc-a243-93dcf0bcf...@postgrespro.ru Backpatch-through: 14 Branch -- master Details -

pgsql: Fix comment related to pg_cryptohash_error()

2022-01-11 Thread Michael Paquier
Fix comment related to pg_cryptohash_error() One of the comments introduced in b69aba7 was worded a bit weirdly, so improve it. Reported-by: Sergey Shinderuk Discussion: https://postgr.es/m/71b9a5d2-a3bf-83bc-a243-93dcf0bcf...@postgrespro.ru Backpatch-through: 14 Branch -- REL_14_STABLE De

Re: pgsql: Clean up error message reported after \password encryption failu

2022-01-11 Thread Michael Paquier
On Tue, Jan 11, 2022 at 05:03:17PM +, Tom Lane wrote: > Clean up error message reported after \password encryption failure. Thanks! -- Michael signature.asc Description: PGP signature

Re: pgsql: Check for STATUS_DELETE_PENDING on Windows.

2022-01-11 Thread Tom Lane
Andrew Dunstan writes: > On 1/11/22 16:22, Thomas Munro wrote: >> Those scripts aren't really on my radar... would it be a good idea to >> run them as steps in the CompilerWarnings CI task? > Or in a buildfarm module (c.f. the perl checks) +1 for one or the other, because we break that regularly

Re: pgsql: Check for STATUS_DELETE_PENDING on Windows.

2022-01-11 Thread Andrew Dunstan
On 1/11/22 16:22, Thomas Munro wrote: > 2. headerscheck and cpluspluscheck don't like it, at least >> not on non-Windows: >> >> $ src/tools/pginclude/headerscheck >> In file included from /tmp/headerscheck.WKh8cz/test.c:2: >> ./src/include/port/win32ntdll.h:20:10: fatal error: ntstatus.h: No such

Re: pgsql: Check for STATUS_DELETE_PENDING on Windows.

2022-01-11 Thread Thomas Munro
On Wed, Jan 12, 2022 at 8:36 AM Tom Lane wrote: > 1. It lacks the usual anti-multiple-inclusion guard, i.e. > #ifndef WIN32NTDLL_H > or the like. Was there a specific reason to omit that? Oops. Fixed. > 2. headerscheck and cpluspluscheck don't like it, at least > not on non-Windows: >

pgsql: Add missing include guard to win32ntdll.h.

2022-01-11 Thread Thomas Munro
Add missing include guard to win32ntdll.h. Oversight in commit e2f0f8ed. Also add this file to the exclusion lists in headerscheck and cpluscpluscheck, because Unix systems don't have a header it includes. Reported-by: Tom Lane Discussion: https://postgr.es/m/2760528.1641929756%40sss.pgh.pa.us

Re: pgsql: Check for STATUS_DELETE_PENDING on Windows.

2022-01-11 Thread Tom Lane
Thomas Munro writes: > Check for STATUS_DELETE_PENDING on Windows. The src/include/port/win32ntdll.h file added by this commit has a couple of deficiencies: 1. It lacks the usual anti-multiple-inclusion guard, i.e. #ifndef WIN32NTDLL_H or the like. Was there a specific reason to omit th

pgsql: Improve error message for missing extension.

2022-01-11 Thread Tom Lane
Improve error message for missing extension. If we get ENOENT while trying to read an extension control file, report that as a missing extension (with a HINT to install it) rather than as a filesystem access problem. The message wording was extensively bikeshedded in hopes of pointing people to t

pgsql: Clean up messy API for src/port/thread.c.

2022-01-11 Thread Tom Lane
Clean up messy API for src/port/thread.c. The point of this patch is to reduce inclusion spam by not needing to #include or in port.h (which is read by every compile in our tree). To do that, we must remove port.h's declarations of pqGetpwuid and pqGethostbyname. pqGethostbyname is only used,

pgsql: Improve warning message in pg_signal_backend()

2022-01-11 Thread John Naylor
Improve warning message in pg_signal_backend() Previously, invoking pg_terminate_backend() or pg_cancel_backend() with the postmaster PID produced a "PID is not a PostgresSQL server process" warning, which does not make sense. Change to "backend process" to make the message more exact. Natha

pgsql: Clean up error message reported after \password encryption failu

2022-01-11 Thread Tom Lane
Clean up error message reported after \password encryption failure. Experimenting with FIPS mode enabled, I saw regression=# \password joe Enter new password for user "joe": Enter it again: could not encrypt password: disabled for FIPS out of memory because PQencryptPasswordConn was still of the

pgsql: Clean up error message reported after \password encryption failu

2022-01-11 Thread Tom Lane
Clean up error message reported after \password encryption failure. Experimenting with FIPS mode enabled, I saw regression=# \password joe Enter new password for user "joe": Enter it again: could not encrypt password: disabled for FIPS out of memory because PQencryptPasswordConn was still of the

pgsql: Enhance pg_log_backend_memory_contexts() for auxiliary processes

2022-01-11 Thread Fujii Masao
Enhance pg_log_backend_memory_contexts() for auxiliary processes. Previously pg_log_backend_memory_contexts() could request to log the memory contexts of backends, but not of auxiliary processes such as checkpointer. This commit enhances the function so that it can also send the request to auxilia