FATAL and Panic errors in PostgreSQL

66 Views Asked by At

Regarding PostgreSQL Documentation: https://www.postgresql.org/docs/current/protocol-error-fields.html, the Severity field contains one of this values: ERROR, FATAL, or PANIC.

Also here is a list of error code: https://www.postgresql.org/docs/current/errcodes-appendix.html

Where can I find the mapping between those error codes and the severity ?

Side question. would it make sense to stop a client microservice app when getting a FATAL or PANIC error type ?

I was expecting something like all error code between xxx and yyy --> ERROR. But can't be able to find something on the internet

1

There are 1 best solutions below

7
Laurenz Albe On

You'd have to read the source to find what message level is used for which message, but the exercise would be pointless, since there is no rule. The same error message could be used with different message levels.

You need to understand the message levels. FATAL doesn't mean that the message is worse than ERROR. It is the level used for an error that leads to the end of the database session. For example, connecting to a harmless, but FATAL error message, because that is the end of the connection attempt. The same message could be an ERROR in a DROP DATABASE statement. ERROR can be much worse than FATAL: think of data corruption.