Re: Access last_sqlstate from libpq

2021-09-17 Thread Tom Lane
Daniel Frey writes: > In case of an error when I received a PGresult*, I can access the SQLSTATE by > calling >PGresult* pgresult = ...; >const char* sqlstate = PQresultErrorField( pgresult, PG_DIAG_SQLSTATE ); Right ... > However, this is not possible in a couple of other cases where

Re: Access last_sqlstate from libpq

2021-09-17 Thread David G. Johnston
On Friday, September 17, 2021, Daniel Frey wrote: > > > Are you sure or are you guessing? > Guessing regarding the implementations of these interfaces. David J.

Re: Access last_sqlstate from libpq

2021-09-17 Thread Daniel Frey
> On 18. Sep 2021, at 01:45, David G. Johnston > wrote: > > > > On Friday, September 17, 2021, Daniel Frey 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) > > * PQputCopyD

Re: Access last_sqlstate from libpq

2021-09-17 Thread David G. Johnston
On Friday, September 17, 2021, Daniel Frey 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 functio

Access last_sqlstate from libpq

2021-09-17 Thread Daniel Frey
Hi, I am the author of a PostgreSQL C++ client library, taoPQ (https://github.com/taocpp/taopq), wrapping the C-API of libpq. In case of an error when I received a PGresult*, I can access the SQLSTATE by calling PGresult* pgresult = ...; const char* sqlstate = PQresultErrorField( pgresul