Avoid null pointer dereference if error result lacks SQLSTATE.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: d1ac060e63961fc6d5eadd27729ff29d5a52f9f1
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2020-11-01T16:26:36Z
Releases: 11.10
Avoid null pointer dereference if error result lacks SQLSTATE.

Although error results received from the backend should always have
a SQLSTATE field, ones generated by libpq won't, making this code
vulnerable to a crash after, say, untimely loss of connection.
Noted by Coverity.

Oversight in commit 403a3d91c.  Back-patch to 9.5, as that was.

Files

PathChange+/−
src/bin/pg_dump/pg_backup_db.c modified +8 −6