Make dblink interruptible, via new libpqsrv APIs.
Noah Misch <noah@leadboat.com>
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.74@rfd.leadboat.com
Files
| Path | Change | +/− |
|---|---|---|
| contrib/dblink/dblink.c | modified | +17 −11 |
| contrib/postgres_fdw/connection.c | modified | +17 −71 |
| contrib/postgres_fdw/deparse.c | modified | +1 −1 |
| contrib/postgres_fdw/postgres_fdw.c | modified | +5 −5 |
| contrib/postgres_fdw/postgres_fdw.h | modified | +1 −1 |
| doc/src/sgml/dblink.sgml | modified | +9 −0 |
| src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | modified | +3 −6 |
| src/include/libpq/libpq-be-fe-helpers.h | modified | +127 −0 |
Documentation touched
Discussion
- dblink query interruptibility 10 messages · 2023-11-22 → 2025-04-05