Postgres has a catalogue of possible error messages here:
http://www.postgresql.org/docs/8.2/static/errcodes-appendix.html#ERRCODES-TABLE
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?
Best Answer
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: