Bug #75
postgres driver never sets seState.
| Status : | Assigned | Start : | 06/08/2008 | |
| Priority : | Normal | Due date : | ||
| Assigned to : | - | % Done : | 0% |
|
| Category : | - | |||
| Target version : | - | |||
| Resolution : |
Description
No testcase -- just look at the code. E.g. from Statement.hsc:
_ -> do l $ "PGRES ERROR: " ++ squery sstate
csstatusmsg <- pqresStatus status
cserrormsg <- pqresultErrorMessage resptr
statusmsg <- peekCString csstatusmsg
errormsg <- peekCString cserrormsg
pqclear_raw resptr
throwDyn $
SqlError {seState = "",
seNativeError = fromIntegral status,
seErrorMsg = "execute: " ++ statusmsg ++
": " ++ errormsg}
As described here: http://www.postgresql.org/docs/8.0/static/libpq-exec.html
it seems that there's no direct function to access the SQL_STATUS of a result but one must instead call
PQresultErrorField(const PGresult *res, int fieldcode) with a fieldcode of PG_DIAG_SQLSTATE.
Shouldn't be too tricky. There are two other places that seState is set to blank, but I'm unsure in both cases of what the appropriate behavior should be in terms of general program logic.