Hi, ErrorResponse message from backend has some field type codes include:
S Severity: the field contents are ERROR, FATAL, or PANIC (in an error message), or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message), or a localized translation of one of these. Always present. C Code: the SQLSTATE code for the error (see Appendix A). Not localizable. Always present. If severity is ERROR, current transaction is aborted but existing session is continued. If it is FATAL or worse, backend disconnects the current session, or even postmaster restarts all backends (which results in session disconnection anyway). Cluster management tools such as pgpool-II has to carefully handle the message because there's big difference between just adborting transaction and disconnecting session. In the former, pgpool just forwards the error message to frontend, but for later, it should disconnect the session. For this purpose, pgpool-II examines SQLSTAE code. Unfortunately some error codes such as 40001(serialization_failure) comes with different severities ERROR or FATAL. Here are some examples: ./tcop/postgres.c- ereport(FATAL, ./tcop/postgres.c: (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), ./tcop/postgres.c- errmsg("terminating connection due to conflict with recovery"), ./tcop/postgres.c- errdetail_recovery_conflict())); ./commands/trigger.c- ereport(ERROR, ./commands/trigger.c: (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), ./commands/trigger.c- errmsg("could not serialize access due to concurrent update"))); ./commands/trigger.c- if (!ItemPointerEquals(&update_ctid, &tuple.t_self)) So I tried to look into severity code to find if it is a fatal error or not. Unfortunately it is almost impossible because it could be localized. My question is, why we need to localize this? It shouldn't be computer recognizable message? Also I wonder why "conflict with recovery" generates same error code as serialization error. For me it seems not very consistent choice. IMO, we should assign different error code for at least brings totally different effect to frontend: aborting transactions or sessions. -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese: http://www.sraoss.co.jp -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers