0

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 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

7 Comments

So the idea of making a graceful shutdown of a microservice receiving FATAL or PANIC error type doesn't make sense ?
That doesn't make sense at all.
Could you be more specific ? I'm in a K8S environment and my idea was if i get a fatal, i prefer to kill the pod and let K8S restart it. I do the same with Kafka and this is working really well. The main trigger is instead of trying to recover from a bad state, i prefer restarting in a "clean" environment
FATAL does need recovery at all. PANIC does, but PostgreSQL will recover automatically. By restarting the server, you'll just increase the down time, and you increase the risk of damaging something.
in a K8S env, I have multiple pod running on multiple node. So shutting down a pod has no impact on the down time. i don't get how PostgreSQL would recover from an error like "FATAL role {name} does not exist". where a restart of the Pod could re run an initialization process and "auto fix" the problem. I'm not saying i'm right, i'm just trying to collect the pro and cons. For example, we do exactly the same for the Kafka consumer. where it's just much more easier to restart the pod when having a Fatal error is much more easier then trying to fix the problem
|

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.