From: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
---|---|
To: | vignesh C <vignesh21(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
Cc: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Log prefix missing for subscriber log messages received from publisher |
Date: | 2025-07-17 15:52:31 |
Message-ID: | 33f8b25d-1ea4-4377-ab8c-c29a9eb02122@oss.nttdata.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2025/07/17 23:34, Fujii Masao wrote:
>> The attached v5 version patch
>> has the changes for the same.
>
> Thanks for updating the patches!
The current patches add nearly identical notice_receiver functions
in multiple places such as libpqwalreceiver.c and elsewhere. To avoid
duplicating the same logic, could we define a shared notice receiver
function in a common file, like libpq-be-fe-helpers.h, and use it in
all three locations?
--------------------
static inline void
libpqsrv_notice_receiver(void *arg, const PGresult *res)
{
char *message;
int len;
char *prefix = (char *) arg;
/*
* Trim the trailing newline from the message text returned from
* PQresultErrorMessage(), as it always includes one, to produce
* cleaner log output.
*/
message = PQresultErrorMessage(res);
len = strlen(message);
if (len > 0 && message[len - 1] == '\n')
len--;
ereport(LOG,
errmsg("received message %s: %.*s", prefix, len, message));
}
--------------------
Regards,
--
Fujii Masao
NTT DATA Japan Corporation
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2025-07-17 15:54:17 | Re: PostgreSQL 16 bug feedback |
Previous Message | Nathan Bossart | 2025-07-17 15:32:10 | Re: small fix for pg_overexplain docs |