postgresql/contrib/dblink
Fujii Masao 06a5c3cdef Set notice receiver before libpq connection startup completes
Commit 112faf1378 added custom notice receivers for replication,
postgres_fdw, and dblink so that remote NOTICE, WARNING, and similar
messages are reported via ereport(). However, those notice receivers were
installed only after libpqsrv_connect() and libpqsrv_connect_params()
returned, by which point libpq connection startup had already completed.
As a result, messages emitted during connection establishment could be
missed.

This commit fixes the issue by splitting libpqsrv_connect() and
libpqsrv_connect_params() into separate start and complete phases:
libpqsrv_connect_start(), libpqsrv_connect_params_start(), and
libpqsrv_connect_complete(). This allows callers to perform
per-connection setup, such as installing a notice receiver, after the
connection has been started but before startup completes.

Note that callers of libpqsrv_connect_start() and
libpqsrv_connect_params_start() must still call
libpqsrv_connect_complete(), even if the start function returns NULL, so
that any external FDs reserved during startup are released properly.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/A2B8B7DE-C119-492F-A9FA-14CF86849777@gmail.com
2026-05-23 00:25:48 +09:00
..
expected oauth: Disallow OAuth connections via postgres_fdw/dblink 2025-04-29 13:08:24 -07:00
sql oauth: Disallow OAuth connections via postgres_fdw/dblink 2025-04-29 13:08:24 -07:00
t Update copyright for 2026 2026-01-01 13:24:10 -05:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
dblink--1.0--1.1.sql Fix typo in update scripts for some contrib modules. 2013-07-19 04:13:01 +09:00
dblink--1.1--1.2.sql Fix parallel-safety markings for contrib/dblink. 2016-06-17 23:08:21 -04:00
dblink--1.2.sql Fix parallel-safety markings for contrib/dblink. 2016-06-17 23:08:21 -04:00
dblink.c Set notice receiver before libpq connection startup completes 2026-05-23 00:25:48 +09:00
dblink.control Update dblink extension for parallel query. 2016-06-17 15:18:44 -04:00
Makefile dblink: SCRAM authentication pass-through 2025-03-26 10:49:23 +01:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_service.conf Diagnose incompatible OpenLDAP versions during build and test. 2014-07-22 11:01:03 -04:00