v6-0003-Use-libpqsrv_notice_receiver-for-remote-server-co.patch
text/x-patch
Filename: v6-0003-Use-libpqsrv_notice_receiver-for-remote-server-co.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v6-0003
Subject: Use libpqsrv_notice_receiver for remote server connections in FDW
| File | + | − |
|---|---|---|
| contrib/postgres_fdw/connection.c | 3 | 0 |
From 4d40ae938e97f5d1b4dc8ec99f6bc0adde57ed2e Mon Sep 17 00:00:00 2001
From: Vignesh C <vignesh21@gmail.com>
Date: Fri, 18 Jul 2025 21:07:35 +0530
Subject: [PATCH v6 3/3] Use libpqsrv_notice_receiver for remote server
connections in FDW
This patch applies the previously introduced libpqsrv_notice_receiver
as the custom PQsetNoticeReceiver handler for remote libpq connections
used by Foreign Data Wrappers. It captures server notices and logs them
via ereport(LOG).
---
contrib/postgres_fdw/connection.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c
index 304f3c20f83..c1ce6f33436 100644
--- a/contrib/postgres_fdw/connection.c
+++ b/contrib/postgres_fdw/connection.c
@@ -625,6 +625,9 @@ connect_pg_server(ForeignServer *server, UserMapping *user)
server->servername),
errdetail_internal("%s", pchomp(PQerrorMessage(conn)))));
+ PQsetNoticeReceiver(conn, libpqsrv_notice_receiver,
+ "received message via remote connection");
+
/* Perform post-connection security checks. */
pgfdw_security_check(keywords, values, user, conn);
--
2.43.0