1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-03 00:26:59 +02:00

Improve error message when PQgetCancel() returns NULL.

There is not a lot to be done in this case since it looks like PostgreSQL disconnected while the query was running, but at least improve the error message and remove the assert, which indicates a coding error.
This commit is contained in:
David Steele
2020-12-01 15:15:35 -05:00
parent d1d25c710d
commit ffc50719d9
3 changed files with 25 additions and 2 deletions

View File

@ -203,7 +203,10 @@ pgClientQuery(PgClient *this, const String *query)
if (busy)
{
PGcancel *cancel = PQgetCancel(this->connection);
CHECK(cancel != NULL);
// If cancel is NULL then more than likely the server process crashed or disconnected
if (cancel == NULL)
THROW_FMT(DbQueryError, "unable to cancel query '%s': connection was lost", strZ(query));
TRY_BEGIN()
{