PostgreSQL: Features new in 7.4: SQL99 compliant error handling

  • libpq: char *PQerrorMessage(const PGconn* conn);
  • libpq: char *PQresultErrorMessage(const PGresult *res);
  • libpq: Retrieve a single field from an error report with: char *PQresultErrorField(const PGresult *res, int fieldcode);
    • fieldcode is:
      • S - Severity: ERROR, FATAL, or PANIC (for an error) or WARNING, NOTICE, DEBUG, INFO, or LOG (for a notice)
      • C - Code: 5 character SQLSTATE code, SQL99 compliant
      • M - Message: Primary human readable message
      • D - Detail: optional detailed message
      • H - Hint: optional hint about what may have caused the error
      • P - Position: optional character offset at which error occured (multibyte aware)
      • W - Where: optional stack trace back (PL functions only)
      • F - File: source code file where error was generated
      • L - Line: line at which the error occured
      • R - Routine: function generating error
Prev

Next

Page 7