summaryrefslogtreecommitdiff
path: root/doc/src/sgml/errcodes.sgml
diff options
context:
space:
mode:
authorTom Lane2013-01-29 22:06:26 +0000
committerTom Lane2013-01-29 22:08:26 +0000
commit991f3e5ab3f8196d18d5b313c81a5f744f3baaea (patch)
tree376f7a4bc5541156a3c270304dc22333f2ba6955 /doc/src/sgml/errcodes.sgml
parent89d00cbe01447fd36edbc3bed659f869b18172d1 (diff)
Provide database object names as separate fields in error messages.
This patch addresses the problem that applications currently have to extract object names from possibly-localized textual error messages, if they want to know for example which index caused a UNIQUE_VIOLATION failure. It adds new error message fields to the wire protocol, which can carry the name of a table, table column, data type, or constraint associated with the error. (Since the protocol spec has always instructed clients to ignore unrecognized field types, this should not create any compatibility problem.) Support for providing these new fields has been added to just a limited set of error reports (mainly, those in the "integrity constraint violation" SQLSTATE class), but we will doubtless add them to more calls in future. Pavel Stehule, reviewed and extensively revised by Peter Geoghegan, with additional hacking by Tom Lane.
Diffstat (limited to 'doc/src/sgml/errcodes.sgml')
-rw-r--r--doc/src/sgml/errcodes.sgml16
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/src/sgml/errcodes.sgml b/doc/src/sgml/errcodes.sgml
index 16cb6c7fcdb..40b4191c104 100644
--- a/doc/src/sgml/errcodes.sgml
+++ b/doc/src/sgml/errcodes.sgml
@@ -27,7 +27,7 @@
According to the standard, the first two characters of an error code
denote a class of errors, while the last three characters indicate
a specific condition within that class. Thus, an application that
- does not recognize the specific error code can still be able to infer
+ does not recognize the specific error code might still be able to infer
what to do from the error class.
</para>
@@ -42,13 +42,25 @@
</para>
<para>
- The symbol shown in the column <quote>Condition Name</quote> is also
+ The symbol shown in the column <quote>Condition Name</quote> is
the condition name to use in <application>PL/pgSQL</>. Condition
names can be written in either upper or lower case. (Note that
<application>PL/pgSQL</> does not recognize warning, as opposed to error,
condition names; those are classes 00, 01, and 02.)
</para>
+ <para>
+ For some types of errors, the server reports the name of a database object
+ (a table, table column, data type, or constraint) associated with the error;
+ for example, the name of the unique constraint that caused a
+ <symbol>unique_violation</> error. Such names are supplied in separate
+ fields of the error report message so that applications need not try to
+ extract them from the possibly-localized human-readable text of the message.
+ As of <productname>PostgreSQL</> 9.3, complete coverage for this feature
+ exists only for errors in SQLSTATE class 23 (integrity constraint
+ violation), but this is likely to be expanded in future.
+ </para>
+
<table id="errcodes-table">
<title><productname>PostgreSQL</productname> Error Codes</title>