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



Reply via email to