The error code is used in two places:
ereport(ERROR, (errcode(ERRCODE_T_R_DEADLOCK_DETECTED), errmsg("canceling statement due to conflict with
recovery"), errdetail("User transaction caused buffer deadlock with recovery.")));
ereport(ERROR, (errcode(ERRCODE_T_R_DEADLOCK_DETECTED), errmsg("deadlock detected"),
errdetail_internal("%s",clientbuf.data), errdetail_log("%s", logbuf.data), errhint("See server log for
querydetails.")));
The latter is a normal deadlock and can be obseved by stats because
pgstat_report_deadlock() is called.
The former is using the same error code but the meaning is pretty
different and users might be confused IMO.
I am not sure sharing the same error code is the best idea here.
Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp