~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/errcodes.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!-- doc/src/sgml/errcodes.sgml -->
 
2
 
 
3
<appendix id="errcodes-appendix">
 
4
 <title><productname>PostgreSQL</productname> Error Codes</title>
 
5
 
 
6
 <indexterm zone="errcodes-appendix">
 
7
  <primary>error codes</primary>
 
8
  <secondary>list of</secondary>
 
9
 </indexterm>
 
10
 
 
11
 <para>
 
12
  All messages emitted by the <productname>PostgreSQL</productname>
 
13
  server are assigned five-character error codes that follow the SQL
 
14
  standard's conventions for <quote>SQLSTATE</> codes.  Applications
 
15
  that need to know which error condition has occurred should usually
 
16
  test the error code, rather than looking at the textual error
 
17
  message.  The error codes are less likely to change across
 
18
  <productname>PostgreSQL</> releases, and also are not subject to
 
19
  change due to localization of error messages. Note that some, but
 
20
  not all, of the error codes produced by <productname>PostgreSQL</>
 
21
  are defined by the SQL standard; some additional error codes for
 
22
  conditions not defined by the standard have been invented or
 
23
  borrowed from other databases.
 
24
 </para>
 
25
 
 
26
 <para>
 
27
  According to the standard, the first two characters of an error code
 
28
  denote a class of errors, while the last three characters indicate
 
29
  a specific condition within that class.  Thus, an application that
 
30
  does not recognize the specific error code can still be able to infer
 
31
  what to do from the error class.
 
32
 </para>
 
33
 
 
34
 <para>
 
35
  <xref linkend="errcodes-table"> lists all the error codes defined in
 
36
  <productname>PostgreSQL</productname> &version;.  (Some are not actually
 
37
  used at present, but are defined by the SQL standard.)
 
38
  The error classes are also shown.  For each error class there is a
 
39
  <quote>standard</> error code having the last three characters
 
40
  <literal>000</>.  This code is used only for error conditions that fall
 
41
  within the class but do not have any more-specific code assigned.
 
42
 </para>
 
43
 
 
44
 <para>
 
45
  The <application>PL/pgSQL</> condition name for each error code is the
 
46
  same as the phrase shown in the table, with underscores substituted
 
47
  for spaces.  For example, code <literal>22012</>, DIVISION BY ZERO,
 
48
  has condition name <literal>DIVISION_BY_ZERO</>.  Condition names can
 
49
  be written in either upper or lower case.  (Note that
 
50
  <application>PL/pgSQL</> does not recognize warning, as opposed to error,
 
51
  condition names; those are classes 00, 01, and 02.)
 
52
 </para>
 
53
 
 
54
 
 
55
<!--
 
56
 The following table should correspond to the contents of
 
57
 src/include/utils/errcodes.h and src/pl/plpgsql/src/plerrcodes.h.
 
58
-->
 
59
 
 
60
<table id="errcodes-table">
 
61
 <title><productname>PostgreSQL</productname> Error Codes</title>
 
62
 
 
63
 <tgroup cols="3">
 
64
  <colspec colnum="1" colname="errorcode">
 
65
  <colspec colnum="3" colname="condname">
 
66
  <spanspec namest="errorcode" nameend="condname" spanname="span13">
 
67
 
 
68
  <thead>
 
69
   <row>
 
70
    <entry>Error Code</entry>
 
71
    <entry>Meaning</entry>
 
72
    <entry>Condition Name</entry>
 
73
   </row>
 
74
  </thead>
 
75
 
 
76
  <tbody>
 
77
 
 
78
    &errcodes-table;
 
79
 
 
80
  </tbody>
 
81
 </tgroup>
 
82
</table>
 
83
 
 
84
 
 
85
</appendix>