From: | Dmitriy Igrishin <dmitigr(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | SQLSTATE of notice PGresult |
Date: | 2010-08-20 10:13:45 |
Message-ID: | [email protected] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hey all,
Accordingly to the documentation of libpq, SQLSTATE code field "is not
localizable, and
is always present.". But it seems, in some cases it isn't. E.g.
/* the main code */
PGresult* res = Pg::PQexec(conn, "select 1");
Oid id = PQparamtype(res, 1);
/* the notice receiver */
void myNoticeReceiver(void *arg, const PGresult *res)
{
/* Presents - "NOTICE" */
const char* severity = Pg::PQresultErrorField(res, PG_DIAG_SEVERITY);
/* NOT presents - NULL. Why not "00000" ? */
const char* sqlstate = Pg::PQresultErrorField(res, PG_DIAG_SQLSTATE);
/* Presents - "parameter number 1 is out of range 0..-1" */
const char* primary = Pg::PQresultErrorField(res,
PG_DIAG_MESSAGE_PRIMARY);
}
So, SQLSTATE field is not always presents.
Regards,
Dmitriy
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2010-08-20 11:02:00 | Re: git: uh-oh |
Previous Message | Magnus Hagander | 2010-08-20 09:21:18 | Re: Fw: patch for pg_ctl.c to add windows service start-type |