postgresql/src/interfaces/libpq
Alvaro Herrera 61461a300c
libpq: Add encrypted and non-blocking query cancellation routines
The existing PQcancel API uses blocking IO, which makes PQcancel
impossible to use in an event loop based codebase without blocking the
event loop until the call returns.  It also doesn't encrypt the
connection over which the cancel request is sent, even when the original
connection required encryption.

This commit adds a PQcancelConn struct and assorted functions, which
provide a better mechanism of sending cancel requests; in particular all
the encryption used in the original connection are also used in the
cancel connection.  The main entry points are:

- PQcancelCreate creates the PQcancelConn based on the original
  connection (but does not establish an actual connection).
- PQcancelStart can be used to initiate non-blocking cancel requests,
  using encryption if the original connection did so, which must be
  pumped using
- PQcancelPoll.
- PQcancelReset puts a PQcancelConn back in state so that it can be
  reused to send a new cancel request to the same connection.
- PQcancelBlocking is a simpler-to-use blocking API that still uses
  encryption.

Additional functions are
 - PQcancelStatus, mimicks PQstatus;
 - PQcancelSocket, mimicks PQcancelSocket;
 - PQcancelErrorMessage, mimicks PQerrorMessage;
 - PQcancelFinish, mimicks PQfinish.

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Denis Laxalde <denis.laxalde@dalibo.com>
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com
2024-03-12 17:32:25 +01:00
..
po Update copyright for 2024 2024-01-03 20:49:05 -05:00
t Update copyright for 2024 2024-01-03 20:49:05 -05:00
test Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
exports.txt libpq: Add encrypted and non-blocking query cancellation routines 2024-03-12 17:32:25 +01:00
fe-auth-sasl.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-auth-scram.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-auth.c Add new function, PQchangePassword(), to libpq 2024-01-09 09:16:48 -05:00
fe-auth.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-cancel.c libpq: Add encrypted and non-blocking query cancellation routines 2024-03-12 17:32:25 +01:00
fe-connect.c libpq: Add encrypted and non-blocking query cancellation routines 2024-03-12 17:32:25 +01:00
fe-exec.c Remove some comments related to pqPipelineSync() and PQsendPipelineSync() 2024-01-17 15:53:59 +09:00
fe-gssapi-common.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-gssapi-common.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-lobj.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-misc.c Avoid concurrent calls to bindtextdomain(). 2024-02-09 11:21:08 -05:00
fe-print.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-protocol3.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-secure-common.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-secure-common.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-secure-gssapi.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-secure-openssl.c Cope with a deficiency in OpenSSL 3.x's error reporting. 2024-03-07 19:38:17 -05:00
fe-secure.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe-trace.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
legacy-pqsignal.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
libpq-events.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
libpq-events.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
libpq-fe.h libpq: Add encrypted and non-blocking query cancellation routines 2024-03-12 17:32:25 +01:00
libpq-int.h libpq: Add encrypted and non-blocking query cancellation routines 2024-03-12 17:32:25 +01:00
Makefile Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Remove AIX support 2024-02-28 15:17:23 +04:00
nls.mk
pg_service.conf.sample
pqexpbuffer.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pqexpbuffer.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pthread-win32.c Clean up Windows-specific mutex code in libpq and ecpglib. 2024-02-09 11:11:39 -05:00
README
win32.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
win32.h

src/interfaces/libpq/README

This directory contains the C version of Libpq, the POSTGRES frontend library.