summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/protocol-error-fields.html
blob: 6d8fbeb971b7c34533f764face065247733f9d63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>55.8. Error and Notice Message Fields</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="protocol-message-formats.html" title="55.7. Message Formats" /><link rel="next" href="protocol-logicalrep-message-formats.html" title="55.9. Logical Replication Message Formats" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">55.8. Error and Notice Message Fields</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="protocol-message-formats.html" title="55.7. Message Formats">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="protocol.html" title="Chapter 55. Frontend/Backend Protocol">Up</a></td><th width="60%" align="center">Chapter 55. Frontend/Backend Protocol</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="protocol-logicalrep-message-formats.html" title="55.9. Logical Replication Message Formats">Next</a></td></tr></table><hr /></div><div class="sect1" id="PROTOCOL-ERROR-FIELDS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">55.8. Error and Notice Message Fields</h2></div></div></div><p>
   This section describes the fields that can appear in ErrorResponse and
   NoticeResponse messages.  Each field type has a single-byte identification
   token.  Note that any given field type should appear at most once per
   message.
  </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">S</code></span></dt><dd><p>
      Severity: the field contents are
      <code class="literal">ERROR</code>, <code class="literal">FATAL</code>, or
      <code class="literal">PANIC</code> (in an error message), or
      <code class="literal">WARNING</code>, <code class="literal">NOTICE</code>, <code class="literal">DEBUG</code>,
      <code class="literal">INFO</code>, or <code class="literal">LOG</code> (in a notice message),
      or a localized translation of one of these.  Always present.
     </p></dd><dt><span class="term"><code class="literal">V</code></span></dt><dd><p>
      Severity: the field contents are
      <code class="literal">ERROR</code>, <code class="literal">FATAL</code>, or
      <code class="literal">PANIC</code> (in an error message), or
      <code class="literal">WARNING</code>, <code class="literal">NOTICE</code>, <code class="literal">DEBUG</code>,
      <code class="literal">INFO</code>, or <code class="literal">LOG</code> (in a notice message).
      This is identical to the <code class="literal">S</code> field except
      that the contents are never localized.  This is present only in
      messages generated by <span class="productname">PostgreSQL</span> versions 9.6
      and later.
     </p></dd><dt><span class="term"><code class="literal">C</code></span></dt><dd><p>
      Code: the SQLSTATE code for the error (see <a class="xref" href="errcodes-appendix.html" title="Appendix A. PostgreSQL Error Codes">Appendix A</a>).  Not localizable.  Always present.
     </p></dd><dt><span class="term"><code class="literal">M</code></span></dt><dd><p>
      Message: the primary human-readable error message.
      This should be accurate but terse (typically one line).
      Always present.
     </p></dd><dt><span class="term"><code class="literal">D</code></span></dt><dd><p>
      Detail: an optional secondary error message carrying more
      detail about the problem.  Might run to multiple lines.
     </p></dd><dt><span class="term"><code class="literal">H</code></span></dt><dd><p>
      Hint: an optional suggestion what to do about the problem.
      This is intended to differ from Detail in that it offers advice
      (potentially inappropriate) rather than hard facts.
      Might run to multiple lines.
     </p></dd><dt><span class="term"><code class="literal">P</code></span></dt><dd><p>
      Position: the field value is a decimal ASCII integer, indicating
      an error cursor position as an index into the original query string.
      The first character has index 1, and positions are measured in
      characters not bytes.
     </p></dd><dt><span class="term"><code class="literal">p</code></span></dt><dd><p>
      Internal position: this is defined the same as the <code class="literal">P</code>
      field, but it is used when the cursor position refers to an internally
      generated command rather than the one submitted by the client.
      The <code class="literal">q</code> field will always appear when this field appears.
     </p></dd><dt><span class="term"><code class="literal">q</code></span></dt><dd><p>
      Internal query: the text of a failed internally-generated command.
      This could be, for example, an SQL query issued by a PL/pgSQL function.
     </p></dd><dt><span class="term"><code class="literal">W</code></span></dt><dd><p>
      Where: an indication of the context in which the error occurred.
      Presently this includes a call stack traceback of active
      procedural language functions and internally-generated queries.
      The trace is one entry per line, most recent first.
     </p></dd><dt><span class="term"><code class="literal">s</code></span></dt><dd><p>
      Schema name: if the error was associated with a specific database
      object, the name of the schema containing that object, if any.
     </p></dd><dt><span class="term"><code class="literal">t</code></span></dt><dd><p>
      Table name: if the error was associated with a specific table, the
      name of the table.  (Refer to the schema name field for the name of
      the table's schema.)
     </p></dd><dt><span class="term"><code class="literal">c</code></span></dt><dd><p>
      Column name: if the error was associated with a specific table column,
      the name of the column.  (Refer to the schema and table name fields to
      identify the table.)
     </p></dd><dt><span class="term"><code class="literal">d</code></span></dt><dd><p>
      Data type name: if the error was associated with a specific data type,
      the name of the data type.  (Refer to the schema name field for the
      name of the data type's schema.)
     </p></dd><dt><span class="term"><code class="literal">n</code></span></dt><dd><p>
      Constraint name: if the error was associated with a specific
      constraint, the name of the constraint.  Refer to fields listed above
      for the associated table or domain.  (For this purpose, indexes are
      treated as constraints, even if they weren't created with constraint
      syntax.)
     </p></dd><dt><span class="term"><code class="literal">F</code></span></dt><dd><p>
      File: the file name of the source-code location where the error
      was reported.
     </p></dd><dt><span class="term"><code class="literal">L</code></span></dt><dd><p>
      Line: the line number of the source-code location where the error
      was reported.
     </p></dd><dt><span class="term"><code class="literal">R</code></span></dt><dd><p>
      Routine: the name of the source-code routine reporting the error.
     </p></dd></dl></div><div class="note"><h3 class="title">Note</h3><p>
    The fields for schema name, table name, column name, data type name, and
    constraint name are supplied only for a limited number of error types;
    see <a class="xref" href="errcodes-appendix.html" title="Appendix A. PostgreSQL Error Codes">Appendix A</a>.  Frontends should not assume that
    the presence of any of these fields guarantees the presence of another
    field.  Core error sources observe the interrelationships noted above, but
    user-defined functions may use these fields in other ways.  In the same
    vein, clients should not assume that these fields denote contemporary
    objects in the current database.
   </p></div><p>
   The client is responsible for formatting displayed information to meet its
   needs; in particular it should break long lines as needed.  Newline characters
   appearing in the error message fields should be treated as paragraph breaks,
   not line breaks.
  </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="protocol-message-formats.html" title="55.7. Message Formats">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="protocol.html" title="Chapter 55. Frontend/Backend Protocol">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="protocol-logicalrep-message-formats.html" title="55.9. Logical Replication Message Formats">Next</a></td></tr><tr><td width="40%" align="left" valign="top">55.7. Message Formats </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 55.9. Logical Replication Message Formats</td></tr></table></div></body></html>