Bug #75

postgres driver never sets seState.

Added by Sterling Clover 178 days ago. Updated 175 days ago.

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.

History

06/11/2008 03:19 PM - John Goerzen

  • Status changed from New to Assigned

Good catch. Do you think you'd be able to provide and test a patch for this? (I'm a bit short on time just now)

Also available in: Atom PDF