Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
2d7a6a9e
Commit
2d7a6a9e
authored
Jul 27, 2003
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move ERRCODE_XXX macros into their own header file.
parent
aec57ea8
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
329 additions
and
295 deletions
+329
-295
doc/src/sgml/sources.sgml
doc/src/sgml/sources.sgml
+20
-8
src/include/utils/elog.h
src/include/utils/elog.h
+4
-287
src/include/utils/errcodes.h
src/include/utils/errcodes.h
+305
-0
No files found.
doc/src/sgml/sources.sgml
View file @
2d7a6a9e
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/sources.sgml,v 2.1
0 2003/07/22 19:00:07
tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/sources.sgml,v 2.1
1 2003/07/27 18:37:52
tgl Exp $
-->
-->
<chapter id="source">
<chapter id="source">
...
@@ -115,7 +115,7 @@ less -x4
...
@@ -115,7 +115,7 @@ less -x4
</programlisting>
</programlisting>
This specifies error severity level <literal>ERROR</> (a run-of-the-mill
This specifies error severity level <literal>ERROR</> (a run-of-the-mill
error). The <function>errcode</> call specifies the SQLSTATE error code
error). The <function>errcode</> call specifies the SQLSTATE error code
using a macro defined in <filename>src/include/utils/e
log
.h</>. The
using a macro defined in <filename>src/include/utils/e
rrcodes
.h</>. The
<function>errmsg</> call provides the primary message text. Notice the
<function>errmsg</> call provides the primary message text. Notice the
extra set of parentheses surrounding the auxiliary function calls ---
extra set of parentheses surrounding the auxiliary function calls ---
these are annoying but syntactically necessary.
these are annoying but syntactically necessary.
...
@@ -144,7 +144,7 @@ less -x4
...
@@ -144,7 +144,7 @@ less -x4
<function>errcode</>(sqlerrcode) specifies the SQLSTATE error identifier
<function>errcode</>(sqlerrcode) specifies the SQLSTATE error identifier
code for the condition. If this routine is not called, the error
code for the condition. If this routine is not called, the error
identifier defaults to
identifier defaults to
<literal>ERRCODE_INTERNAL_ERROR</> when the error level is
<literal>ERRCODE_INTERNAL_ERROR</> when the error
severity
level is
<literal>ERROR</> or higher, <literal>ERRCODE_WARNING</> when the
<literal>ERROR</> or higher, <literal>ERRCODE_WARNING</> when the
error level is <literal>WARNING</>, otherwise (for <literal>NOTICE</>
error level is <literal>WARNING</>, otherwise (for <literal>NOTICE</>
and below) <literal>ERRCODE_SUCCESSFUL_COMPLETION</>.
and below) <literal>ERRCODE_SUCCESSFUL_COMPLETION</>.
...
@@ -245,11 +245,23 @@ less -x4
...
@@ -245,11 +245,23 @@ less -x4
</para>
</para>
<para>
<para>
You may also see uses of the older function <function>elog</>. This
There is an older function <function>elog</> that is still heavily used.
is equivalent to an <function>ereport</> call specifying only severity
An <function>elog</> call
level and primary message. <function>elog</> should only be used if
<programlisting>
the default errcode assignment is appropriate; this generally restricts
elog(level, "format string", ...);
its use to internal errors and debug logging output.
</programlisting>
is exactly equivalent to
<programlisting>
ereport(level, (errmsg_internal("format string", ...)));
</programlisting>
Notice that the SQLSTATE errcode is always defaulted, and the message
string is not included in the internationalization message dictionary.
Therefore, <function>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 <function>ereport</>. Nonetheless,
there are enough internal <quote>can't happen</> error checks in the
system that <function>elog</> is still widely used; it is preferred for
those messages for its notational simplicity.
</para>
</para>
<para>
<para>
...
...
src/include/utils/elog.h
View file @
2d7a6a9e
This diff is collapsed.
Click to expand it.
src/include/utils/errcodes.h
0 → 100644
View file @
2d7a6a9e
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment