On Friday, September 17, 2021, Daniel Frey <
d.frey@gmx.de> wrote:
However, this is not possible in a couple of other cases where I don't have a PGresult*, only the PGconn* is available:
* PQconnectdb (and variants)
* PQputCopyData
* PQputCopyEnd
* PQgetCopyData
* lo_* (large object functions)
After some research, it appears that PGconn* does have a field called last_sqlstate - it just can't be accessed.
Are there any problems adding a simple accessor to libpq? Or is there some way to access it that I'm missing?
I suspect the reason for the omission is that there isn’t any usable data to be gotten. Those interfaces are not SQL interfaces and thus do not have a relevant last_sqlstate to report.
David J.