mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Improve documentation for SQLSTATE error codes, per recent thread on
-patches.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/errcodes.sgml,v 1.3 2004/03/04 21:47:18 neilc Exp $ -->
 | 
					<!-- $PostgreSQL: pgsql/doc/src/sgml/errcodes.sgml,v 1.4 2004/05/14 18:04:02 neilc Exp $ -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<appendix id="errcodes-appendix">
 | 
					<appendix id="errcodes-appendix">
 | 
				
			||||||
 <title><productname>PostgreSQL</productname> Error Codes</title>
 | 
					 <title><productname>PostgreSQL</productname> Error Codes</title>
 | 
				
			||||||
@@ -9,13 +9,18 @@
 | 
				
			|||||||
 </indexterm>
 | 
					 </indexterm>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 <para>
 | 
					 <para>
 | 
				
			||||||
  All messages emitted by the <productname>PostgreSQL</productname> server
 | 
					  All messages emitted by the <productname>PostgreSQL</productname>
 | 
				
			||||||
  are assigned five-character error codes that follow the SQL standard's
 | 
					  server are assigned five-character error codes that follow the SQL
 | 
				
			||||||
  conventions for <quote>SQLSTATE</> codes.  Applications that need to know
 | 
					  standard's conventions for <quote>SQLSTATE</> codes.  Applications
 | 
				
			||||||
  which error condition has occurred should usually test the error code,
 | 
					  that need to know which error condition has occurred should usually
 | 
				
			||||||
  rather than looking at the textual error message.  The error codes are
 | 
					  test the error code, rather than looking at the textual error
 | 
				
			||||||
  less likely to change across <productname>PostgreSQL</productname> releases,
 | 
					  message.  The error codes are less likely to change across
 | 
				
			||||||
  and also are not subject to change due to localization of error messages.
 | 
					  <productname>PostgreSQL</> releases, and also are not subject to
 | 
				
			||||||
 | 
					  change due to localization of error messages. Note that some, but
 | 
				
			||||||
 | 
					  not all, of the error codes produced by <productname>PostgreSQL</>
 | 
				
			||||||
 | 
					  are defined by the SQL standard; some additional error codes for
 | 
				
			||||||
 | 
					  conditions not defined by the standard have been invented or
 | 
				
			||||||
 | 
					  borrowed from other databases.
 | 
				
			||||||
 </para>
 | 
					 </para>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 <para>
 | 
					 <para>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
<!--
 | 
					<!--
 | 
				
			||||||
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.154 2004/04/24 22:58:40 neilc Exp $
 | 
					$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.155 2004/05/14 18:04:02 neilc Exp $
 | 
				
			||||||
-->
 | 
					-->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 <chapter id="libpq">
 | 
					 <chapter id="libpq">
 | 
				
			||||||
@@ -1336,12 +1336,20 @@ localized translation of one of these.  Always present.
 | 
				
			|||||||
</varlistentry>
 | 
					</varlistentry>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<varlistentry>
 | 
					<varlistentry>
 | 
				
			||||||
 | 
					 <indexterm>
 | 
				
			||||||
 | 
					  <primary>error codes</primary>
 | 
				
			||||||
 | 
					  <secondary>libpq</secondary>
 | 
				
			||||||
 | 
					 </indexterm>
 | 
				
			||||||
<term><symbol>PG_DIAG_SQLSTATE</>
 | 
					<term><symbol>PG_DIAG_SQLSTATE</>
 | 
				
			||||||
</term>
 | 
					</term>
 | 
				
			||||||
<listitem>
 | 
					<listitem>
 | 
				
			||||||
<para>
 | 
					<para>
 | 
				
			||||||
The SQLSTATE code for the error (see <xref linkend="errcodes-appendix">).
 | 
					The SQLSTATE code for the error. The SQLSTATE code identifies the type
 | 
				
			||||||
Not localizable.  Always present.
 | 
					of error that has occurred; it can be used by front-end applications
 | 
				
			||||||
 | 
					to perform specific operations (such as error handling) in response to
 | 
				
			||||||
 | 
					a particular database error. For a list of the possible SQLSTATE
 | 
				
			||||||
 | 
					codes, see <xref linkend="errcodes-appendix">. This field is not
 | 
				
			||||||
 | 
					localizable, and is always present.
 | 
				
			||||||
</para>
 | 
					</para>
 | 
				
			||||||
</listitem>
 | 
					</listitem>
 | 
				
			||||||
</varlistentry>
 | 
					</varlistentry>
 | 
				
			||||||
@@ -1871,7 +1879,7 @@ on <function>PQfsize</function> to obtain the actual data length.
 | 
				
			|||||||
          Prints out all the rows and,  optionally,  the
 | 
					          Prints out all the rows and,  optionally,  the
 | 
				
			||||||
          column names  to  the specified output stream.
 | 
					          column names  to  the specified output stream.
 | 
				
			||||||
<synopsis>
 | 
					<synopsis>
 | 
				
			||||||
void PQprint(FILE* fout,      /* output stream */
 | 
					void PQprint(FILE *fout,      /* output stream */
 | 
				
			||||||
             const PGresult *res,
 | 
					             const PGresult *res,
 | 
				
			||||||
             const PQprintOpt *po);
 | 
					             const PQprintOpt *po);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -3217,15 +3225,15 @@ typedef enum {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity);
 | 
					PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity);
 | 
				
			||||||
</synopsis>
 | 
					</synopsis>
 | 
				
			||||||
<function>PQsetErrorVerbosity</> sets the verbosity mode, returning the
 | 
					<function>PQsetErrorVerbosity</> sets the verbosity mode, returning
 | 
				
			||||||
connection's previous setting.
 | 
					the connection's previous setting.  In <firstterm>TERSE</> mode,
 | 
				
			||||||
In <firstterm>terse</> mode, returned messages include severity, primary text, and position
 | 
					returned messages include severity, primary text, and position only;
 | 
				
			||||||
only; this will normally fit on a single line.  The default mode produces
 | 
					this will normally fit on a single line.  The default mode produces
 | 
				
			||||||
messages that include the above plus any detail, hint, or context fields
 | 
					messages that include the above plus any detail, hint, or context
 | 
				
			||||||
(these may span multiple lines).  The <firstterm>VERBOSE</> mode includes all available
 | 
					fields (these may span multiple lines).  The <firstterm>VERBOSE</>
 | 
				
			||||||
fields.  Changing the verbosity does not affect the messages available from
 | 
					mode includes all available fields.  Changing the verbosity does not
 | 
				
			||||||
already-existing <structname>PGresult</> objects, only subsequently-created
 | 
					affect the messages available from already-existing
 | 
				
			||||||
ones.
 | 
					<structname>PGresult</> objects, only subsequently-created ones.
 | 
				
			||||||
</para>
 | 
					</para>
 | 
				
			||||||
</listitem>
 | 
					</listitem>
 | 
				
			||||||
</varlistentry>
 | 
					</varlistentry>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * Copyright (c) 2003, PostgreSQL Global Development Group
 | 
					 * Copyright (c) 2003, PostgreSQL Global Development Group
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * $PostgreSQL: pgsql/src/include/utils/errcodes.h,v 1.8 2004/03/04 21:47:18 neilc Exp $
 | 
					 * $PostgreSQL: pgsql/src/include/utils/errcodes.h,v 1.9 2004/05/14 18:04:02 neilc Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *-------------------------------------------------------------------------
 | 
					 *-------------------------------------------------------------------------
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -30,8 +30,24 @@
 | 
				
			|||||||
 * class (the first two characters of the code value identify the class).
 | 
					 * class (the first two characters of the code value identify the class).
 | 
				
			||||||
 * The listing is organized by class to make this prominent.
 | 
					 * The listing is organized by class to make this prominent.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * The generic '000' class code should be used for an error only when there
 | 
					 * The generic '000' subclass code should be used for an error only
 | 
				
			||||||
 * is not a more-specific code defined.
 | 
					 * when there is not a more-specific subclass code defined.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The SQL spec requires that all the elements of a SQLSTATE code be
 | 
				
			||||||
 | 
					 * either digits or upper-case ASCII characters.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Classes that begin with 0-4 or A-H are defined by the
 | 
				
			||||||
 | 
					 * standard. Within such a class, subclass values defined by the
 | 
				
			||||||
 | 
					 * standard must begin with 0-4 or A-H. To define a new error code,
 | 
				
			||||||
 | 
					 * ensure that it is either in an "implementation-defined class" (it
 | 
				
			||||||
 | 
					 * begins with 5-9 or I-Z), or its subclass falls outside the range of
 | 
				
			||||||
 | 
					 * error codes that could be present in future versions of the
 | 
				
			||||||
 | 
					 * standard (i.e. the subclass value begins with 5-9 or I-Z).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The convention is that new error codes defined by PostgreSQL in a
 | 
				
			||||||
 | 
					 * class defined by the standard have a subclass value that begins
 | 
				
			||||||
 | 
					 * with 'P'. In addition, error codes defined by PostgreSQL clients
 | 
				
			||||||
 | 
					 * (such as ecpg) have a class value that begins with 'Y'.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Class 00 - Successful Completion */
 | 
					/* Class 00 - Successful Completion */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user