mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -653,12 +653,9 @@ libpqrcv_readtimelinehistoryfile(WalReceiverConn *conn,
|
||||
* Send a query and wait for the results by using the asynchronous libpq
|
||||
* functions and socket readiness events.
|
||||
*
|
||||
* We must not use the regular blocking libpq functions like PQexec()
|
||||
* since they are uninterruptible by signals on some platforms, such as
|
||||
* Windows.
|
||||
*
|
||||
* The function is modeled on PQexec() in libpq, but only implements
|
||||
* those parts that are in use in the walreceiver api.
|
||||
* The function is modeled on libpqsrv_exec(), with the behavior difference
|
||||
* being that it calls ProcessWalRcvInterrupts(). As an optimization, it
|
||||
* skips try/catch, since all errors terminate the process.
|
||||
*
|
||||
* May return NULL, rather than an error result, on failure.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user