Make dblink interruptible, via new libpqsrv APIs.
authorNoah Misch <[email protected]>
Mon, 8 Jan 2024 19:39:56 +0000 (11:39 -0800)
committerNoah Misch <[email protected]>
Mon, 8 Jan 2024 19:39:56 +0000 (11:39 -0800)
commitd3c5f37dd543498cc7c678815d3921823beec9e9
tree9c430f23ec95036ded0b8bb16446b30528159c9e
parent0efc8318477714600567d15812dc8d15841e269e
Make dblink interruptible, via new libpqsrv APIs.

This replaces dblink's blocking libpq calls, allowing cancellation and
allowing DROP DATABASE (of a database not involved in the query).  Apart
from explicit dblink_cancel_query() calls, dblink still doesn't cancel
the remote side.  The replacement for the blocking calls consists of
new, general-purpose query execution wrappers in the libpqsrv facility.
Out-of-tree extensions should adopt these.  Use them in postgres_fdw,
replacing a local implementation from which the libpqsrv implementation
derives.  This is a bug fix for dblink.  Code inspection identified the
bug at least thirteen years ago, but user complaints have not appeared.
Hence, no back-patch for now.

Discussion: https://postgr.es/m/20231122012945[email protected]
contrib/dblink/dblink.c
contrib/postgres_fdw/connection.c
contrib/postgres_fdw/deparse.c
contrib/postgres_fdw/postgres_fdw.c
contrib/postgres_fdw/postgres_fdw.h
doc/src/sgml/dblink.sgml
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
src/include/libpq/libpq-be-fe-helpers.h