Postgres has a catalogue of possible error messages here:


However, I would like to query this information from a system view instead of looking it up on web page (in order to check that I handle all messages correctly in my code).

Is there a way to ask Postgres via a pg_something view or table what error messages it can raise? Also, where does Postgres store the translation (if any) of these messages?

  • 1
    Is there any reason why you are looking at the manual of a completely outdated and un-maintained version? As far as I know the error message are compiled directly into the executables. You could probably do some intelligent grep-ing on the source code
    – user1822
    Commented Jan 19, 2015 at 19:01
  • Just picked up the first Google result I could find for the error messages. Commented Jan 19, 2015 at 23:17
  • I was hoping I didn't have to grep the source. Would be very nice to programatically be able to connect to any postgres instance and extract the error codes that are valid for the version that happens to run. Commented Jan 19, 2015 at 23:17

1 Answer 1


It looks like there is no easy to use SQL to query error codes inside Postgres. However, the source does contain the following file:


Which has the code listed in an easily parsable format:

01000    W    ERRCODE_WARNING                                                warning
0100C    W    ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED                   dynamic_result_sets_returned
01008    W    ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING                      implicit_zero_bit_padding
01003    W    ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION          null_value_eliminated_in_set_function
01007    W    ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED                          privilege_not_granted
01006    W    ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED                          privilege_not_revoked
01004    W    ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION                   string_data_right_truncation
01P01    W    ERRCODE_WARNING_DEPRECATED_FEATURE                             deprecated_feature

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.