~ubuntu-branches/debian/experimental/postgresql-11/experimental

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Christoph Berg
  • Date: 2018-05-22 14:19:08 UTC
  • Revision ID: package-import@ubuntu.com-20180522141908-0oy9ujs1b5vrda74
Tags: upstream-11~beta1
ImportĀ upstreamĀ versionĀ 11~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</quote> 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</productname> 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</productname>
 
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 might 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</quote> error code having the last three characters
 
40
  <literal>000</literal>.  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 symbol shown in the column <quote>Condition Name</quote> is
 
46
  the condition name to use in <application>PL/pgSQL</application>.  Condition
 
47
  names can be written in either upper or lower case.  (Note that
 
48
  <application>PL/pgSQL</application> does not recognize warning, as opposed to error,
 
49
  condition names; those are classes 00, 01, and 02.)
 
50
 </para>
 
51
 
 
52
 <para>
 
53
  For some types of errors, the server reports the name of a database object
 
54
  (a table, table column, data type, or constraint) associated with the error;
 
55
  for example, the name of the unique constraint that caused a
 
56
  <symbol>unique_violation</symbol> error.  Such names are supplied in separate
 
57
  fields of the error report message so that applications need not try to
 
58
  extract them from the possibly-localized human-readable text of the message.
 
59
  As of <productname>PostgreSQL</productname> 9.3, complete coverage for this feature
 
60
  exists only for errors in SQLSTATE class 23 (integrity constraint
 
61
  violation), but this is likely to be expanded in future.
 
62
 </para>
 
63
 
 
64
 
 
65
<table id="errcodes-table">
 
66
 <title><productname>PostgreSQL</productname> Error Codes</title>
 
67
 
 
68
 <tgroup cols="2">
 
69
  <colspec colnum="1" colname="errorcode"/>
 
70
  <colspec colnum="2" colname="condname"/>
 
71
  <spanspec namest="errorcode" nameend="condname" spanname="span12"/>
 
72
 
 
73
  <thead>
 
74
   <row>
 
75
    <entry>Error Code</entry>
 
76
    <entry>Condition Name</entry>
 
77
   </row>
 
78
  </thead>
 
79
 
 
80
  <tbody>
 
81
 
 
82
    &errcodes-table;
 
83
 
 
84
  </tbody>
 
85
 </tgroup>
 
86
</table>
 
87
 
 
88
 
 
89
</appendix>