From 2d7a6a9ef27e738a3d7fdc65bde65d97da486342 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 27 Jul 2003 18:37:52 +0000 Subject: Move ERRCODE_XXX macros into their own header file. --- doc/src/sgml/sources.sgml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml index 57a587e24fd..6ff47c989c9 100644 --- a/doc/src/sgml/sources.sgml +++ b/doc/src/sgml/sources.sgml @@ -1,5 +1,5 @@ @@ -115,7 +115,7 @@ less -x4 This specifies error severity level ERROR (a run-of-the-mill error). The errcode call specifies the SQLSTATE error code - using a macro defined in src/include/utils/elog.h. The + using a macro defined in src/include/utils/errcodes.h. The errmsg call provides the primary message text. Notice the extra set of parentheses surrounding the auxiliary function calls --- these are annoying but syntactically necessary. @@ -144,7 +144,7 @@ less -x4 errcode(sqlerrcode) specifies the SQLSTATE error identifier code for the condition. If this routine is not called, the error identifier defaults to - ERRCODE_INTERNAL_ERROR when the error level is + ERRCODE_INTERNAL_ERROR when the error severity level is ERROR or higher, ERRCODE_WARNING when the error level is WARNING, otherwise (for NOTICE and below) ERRCODE_SUCCESSFUL_COMPLETION. @@ -245,11 +245,23 @@ less -x4 - You may also see uses of the older function elog. This - is equivalent to an ereport call specifying only severity - level and primary message. elog should only be used if - the default errcode assignment is appropriate; this generally restricts - its use to internal errors and debug logging output. + There is an older function elog that is still heavily used. + An elog call + + elog(level, "format string", ...); + + is exactly equivalent to + + ereport(level, (errmsg_internal("format string", ...))); + + Notice that the SQLSTATE errcode is always defaulted, and the message + string is not included in the internationalization message dictionary. + Therefore, elog should be used only for internal errors and + low-level debug logging. Any message that is likely to be of interest to + ordinary users should go through ereport. Nonetheless, + there are enough internal can't happen error checks in the + system that elog is still widely used; it is preferred for + those messages for its notational simplicity. -- cgit v1.2.3