<!-- doc/src/sgml/errcodes.sgml -->

<appendix id="errcodes-appendix">
 <title><productname>PostgreSQL</productname> Error Codes</title>

 <indexterm zone="errcodes-appendix">
  <primary>error codes</primary>
  <secondary>list of</secondary>
 </indexterm>

 <para>
  All messages emitted by the <productname>PostgreSQL</productname>
  server are assigned five-character error codes that follow the SQL
  standard's conventions for <quote>SQLSTATE</> codes.  Applications
  that need to know which error condition has occurred should usually
  test the error code, rather than looking at the textual error
  message.  The error codes are less likely to change across
  <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>
  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
  what to do from the error class.
 </para>

 <para>
  <xref linkend="errcodes-table"> lists all the error codes defined in
  <productname>PostgreSQL</productname> &version;.  (Some are not actually
  used at present, but are defined by the SQL standard.)
  The error classes are also shown.  For each error class there is a
  <quote>standard</> error code having the last three characters
  <literal>000</>.  This code is used only for error conditions that fall
  within the class but do not have any more-specific code assigned.
 </para>

 <para>
  The <application>PL/pgSQL</> condition name for each error code is the
  same as the phrase shown in the table, with underscores substituted
  for spaces.  For example, code <literal>22012</>, DIVISION BY ZERO,
  has condition name <literal>DIVISION_BY_ZERO</>.  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>


<!--
 The following table should correspond to the contents of
 src/include/utils/errcodes.h and src/pl/plpgsql/src/plerrcodes.h.
-->

<table id="errcodes-table">
 <title><productname>PostgreSQL</productname> Error Codes</title>

 <tgroup cols="3">
  <colspec colnum="1" colname="errorcode">
  <colspec colnum="3" colname="condname">
  <spanspec namest="errorcode" nameend="condname" spanname="span13">

  <thead>
   <row>
    <entry>Error Code</entry>
    <entry>Meaning</entry>
    <entry>Condition Name</entry>
   </row>
  </thead>

  <tbody>

<row>
<entry spanname="span13"><emphasis role="bold">Class 00 &mdash; Successful Completion</></entry>
</row>

<row>
<entry><literal>00000</literal></entry>
<entry>SUCCESSFUL COMPLETION</entry>
<entry>successful_completion</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 01 &mdash; Warning</></entry>
</row>

<row>
<entry><literal>01000</literal></entry>
<entry>WARNING</entry>
<entry>warning</entry>
</row>

<row>
<entry><literal>0100C</literal></entry>
<entry>DYNAMIC RESULT SETS RETURNED</entry>
<entry>dynamic_result_sets_returned</entry>
</row>

<row>
<entry><literal>01008</literal></entry>
<entry>IMPLICIT ZERO BIT PADDING</entry>
<entry>implicit_zero_bit_padding</entry>
</row>

<row>
<entry><literal>01003</literal></entry>
<entry>NULL VALUE ELIMINATED IN SET FUNCTION</entry>
<entry>null_value_eliminated_in_set_function</entry>
</row>

<row>
<entry><literal>01007</literal></entry>
<entry>PRIVILEGE NOT GRANTED</entry>
<entry>privilege_not_granted</entry>
</row>

<row>
<entry><literal>01006</literal></entry>
<entry>PRIVILEGE NOT REVOKED</entry>
<entry>privilege_not_revoked</entry>
</row>

<row>
<entry><literal>01004</literal></entry>
<entry>STRING DATA RIGHT TRUNCATION</entry>
<entry>string_data_right_truncation</entry>
</row>

<row>
<entry><literal>01P01</literal></entry>
<entry>DEPRECATED FEATURE</entry>
<entry>deprecated_feature</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 02 &mdash; No Data (this is also a warning class per the SQL standard)</></entry>
</row>

<row>
<entry><literal>02000</literal></entry>
<entry>NO DATA</entry>
<entry>no_data</entry>
</row>

<row>
<entry><literal>02001</literal></entry>
<entry>NO ADDITIONAL DYNAMIC RESULT SETS RETURNED</entry>
<entry>no_additional_dynamic_result_sets_returned</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 03 &mdash; SQL Statement Not Yet Complete</></entry>
</row>

<row>
<entry><literal>03000</literal></entry>
<entry>SQL STATEMENT NOT YET COMPLETE</entry>
<entry>sql_statement_not_yet_complete</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 08 &mdash; Connection Exception</></entry>
</row>

<row>
<entry><literal>08000</literal></entry>
<entry>CONNECTION EXCEPTION</entry>
<entry>connection_exception</entry>
</row>

<row>
<entry><literal>08003</literal></entry>
<entry>CONNECTION DOES NOT EXIST</entry>
<entry>connection_does_not_exist</entry>
</row>

<row>
<entry><literal>08006</literal></entry>
<entry>CONNECTION FAILURE</entry>
<entry>connection_failure</entry>
</row>

<row>
<entry><literal>08001</literal></entry>
<entry>SQLCLIENT UNABLE TO ESTABLISH SQLCONNECTION</entry>
<entry>sqlclient_unable_to_establish_sqlconnection</entry>
</row>

<row>
<entry><literal>08004</literal></entry>
<entry>SQLSERVER REJECTED ESTABLISHMENT OF SQLCONNECTION</entry>
<entry>sqlserver_rejected_establishment_of_sqlconnection</entry>
</row>

<row>
<entry><literal>08007</literal></entry>
<entry>TRANSACTION RESOLUTION UNKNOWN</entry>
<entry>transaction_resolution_unknown</entry>
</row>

<row>
<entry><literal>08P01</literal></entry>
<entry>PROTOCOL VIOLATION</entry>
<entry>protocol_violation</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 09 &mdash; Triggered Action Exception</></entry>
</row>

<row>
<entry><literal>09000</literal></entry>
<entry>TRIGGERED ACTION EXCEPTION</entry>
<entry>triggered_action_exception</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 0A &mdash; Feature Not Supported</></entry>
</row>

<row>
<entry><literal>0A000</literal></entry>
<entry>FEATURE NOT SUPPORTED</entry>
<entry>feature_not_supported</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 0B &mdash; Invalid Transaction Initiation</></entry>
</row>

<row>
<entry><literal>0B000</literal></entry>
<entry>INVALID TRANSACTION INITIATION</entry>
<entry>invalid_transaction_initiation</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 0F &mdash; Locator Exception</></entry>
</row>

<row>
<entry><literal>0F000</literal></entry>
<entry>LOCATOR EXCEPTION</entry>
<entry>locator_exception</entry>
</row>

<row>
<entry><literal>0F001</literal></entry>
<entry>INVALID LOCATOR SPECIFICATION</entry>
<entry>invalid_locator_specification</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 0L &mdash; Invalid Grantor</></entry>
</row>

<row>
<entry><literal>0L000</literal></entry>
<entry>INVALID GRANTOR</entry>
<entry>invalid_grantor</entry>
</row>

<row>
<entry><literal>0LP01</literal></entry>
<entry>INVALID GRANT OPERATION</entry>
<entry>invalid_grant_operation</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 0P &mdash; Invalid Role Specification</></entry>
</row>

<row>
<entry><literal>0P000</literal></entry>
<entry>INVALID ROLE SPECIFICATION</entry>
<entry>invalid_role_specification</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 20 &mdash; Case Not Found</></entry>
</row>

<row>
<entry><literal>20000</literal></entry>
<entry>CASE NOT FOUND</entry>
<entry>case_not_found</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 21 &mdash; Cardinality Violation</></entry>
</row>

<row>
<entry><literal>21000</literal></entry>
<entry>CARDINALITY VIOLATION</entry>
<entry>cardinality_violation</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 22 &mdash; Data Exception</></entry>
</row>

<row>
<entry><literal>22000</literal></entry>
<entry>DATA EXCEPTION</entry>
<entry>data_exception</entry>
</row>

<row>
<entry><literal>2202E</literal></entry>
<entry>ARRAY SUBSCRIPT ERROR</entry>
<entry>array_subscript_error</entry>
</row>

<row>
<entry><literal>22021</literal></entry>
<entry>CHARACTER NOT IN REPERTOIRE</entry>
<entry>character_not_in_repertoire</entry>
</row>

<row>
<entry><literal>22008</literal></entry>
<entry>DATETIME FIELD OVERFLOW</entry>
<entry>datetime_field_overflow</entry>
</row>

<row>
<entry><literal>22012</literal></entry>
<entry>DIVISION BY ZERO</entry>
<entry>division_by_zero</entry>
</row>

<row>
<entry><literal>22005</literal></entry>
<entry>ERROR IN ASSIGNMENT</entry>
<entry>error_in_assignment</entry>
</row>

<row>
<entry><literal>2200B</literal></entry>
<entry>ESCAPE CHARACTER CONFLICT</entry>
<entry>escape_character_conflict</entry>
</row>

<row>
<entry><literal>22022</literal></entry>
<entry>INDICATOR OVERFLOW</entry>
<entry>indicator_overflow</entry>
</row>

<row>
<entry><literal>22015</literal></entry>
<entry>INTERVAL FIELD OVERFLOW</entry>
<entry>interval_field_overflow</entry>
</row>

<row>
<entry><literal>2201E</literal></entry>
<entry>INVALID ARGUMENT FOR LOGARITHM</entry>
<entry>invalid_argument_for_logarithm</entry>
</row>

<row>
<entry><literal>22014</literal></entry>
<entry>INVALID ARGUMENT FOR NTILE FUNCTION</entry>
<entry>invalid_argument_for_ntile_function</entry>
</row>

<row>
<entry><literal>22016</literal></entry>
<entry>INVALID ARGUMENT FOR NTH_VALUE FUNCTION</entry>
<entry>invalid_argument_for_nth_value_function</entry>
</row>

<row>
<entry><literal>2201F</literal></entry>
<entry>INVALID ARGUMENT FOR POWER FUNCTION</entry>
<entry>invalid_argument_for_power_function</entry>
</row>

<row>
<entry><literal>2201G</literal></entry>
<entry>INVALID ARGUMENT FOR WIDTH BUCKET FUNCTION</entry>
<entry>invalid_argument_for_width_bucket_function</entry>
</row>

<row>
<entry><literal>22018</literal></entry>
<entry>INVALID CHARACTER VALUE FOR CAST</entry>
<entry>invalid_character_value_for_cast</entry>
</row>

<row>
<entry><literal>22007</literal></entry>
<entry>INVALID DATETIME FORMAT</entry>
<entry>invalid_datetime_format</entry>
</row>

<row>
<entry><literal>22019</literal></entry>
<entry>INVALID ESCAPE CHARACTER</entry>
<entry>invalid_escape_character</entry>
</row>

<row>
<entry><literal>2200D</literal></entry>
<entry>INVALID ESCAPE OCTET</entry>
<entry>invalid_escape_octet</entry>
</row>

<row>
<entry><literal>22025</literal></entry>
<entry>INVALID ESCAPE SEQUENCE</entry>
<entry>invalid_escape_sequence</entry>
</row>

<row>
<entry><literal>22P06</literal></entry>
<entry>NONSTANDARD USE OF ESCAPE CHARACTER</entry>
<entry>nonstandard_use_of_escape_character</entry>
</row>

<row>
<entry><literal>22010</literal></entry>
<entry>INVALID INDICATOR PARAMETER VALUE</entry>
<entry>invalid_indicator_parameter_value</entry>
</row>

<row>
<entry><literal>22023</literal></entry>
<entry>INVALID PARAMETER VALUE</entry>
<entry>invalid_parameter_value</entry>
</row>

<row>
<entry><literal>2201B</literal></entry>
<entry>INVALID REGULAR EXPRESSION</entry>
<entry>invalid_regular_expression</entry>
</row>

<row>
<entry><literal>2201W</literal></entry>
<entry>INVALID ROW COUNT IN LIMIT CLAUSE</entry>
<entry>invalid_row_count_in_limit_clause</entry>
</row>

<row>
<entry><literal>2201X</literal></entry>
<entry>INVALID ROW COUNT IN RESULT OFFSET CLAUSE</entry>
<entry>invalid_row_count_in_result_offset_clause</entry>
</row>

<row>
<entry><literal>22009</literal></entry>
<entry>INVALID TIME ZONE DISPLACEMENT VALUE</entry>
<entry>invalid_time_zone_displacement_value</entry>
</row>

<row>
<entry><literal>2200C</literal></entry>
<entry>INVALID USE OF ESCAPE CHARACTER</entry>
<entry>invalid_use_of_escape_character</entry>
</row>

<row>
<entry><literal>2200G</literal></entry>
<entry>MOST SPECIFIC TYPE MISMATCH</entry>
<entry>most_specific_type_mismatch</entry>
</row>

<row>
<entry><literal>22004</literal></entry>
<entry>NULL VALUE NOT ALLOWED</entry>
<entry>null_value_not_allowed</entry>
</row>

<row>
<entry><literal>22002</literal></entry>
<entry>NULL VALUE NO INDICATOR PARAMETER</entry>
<entry>null_value_no_indicator_parameter</entry>
</row>

<row>
<entry><literal>22003</literal></entry>
<entry>NUMERIC VALUE OUT OF RANGE</entry>
<entry>numeric_value_out_of_range</entry>
</row>

<row>
<entry><literal>22026</literal></entry>
<entry>STRING DATA LENGTH MISMATCH</entry>
<entry>string_data_length_mismatch</entry>
</row>

<row>
<entry><literal>22001</literal></entry>
<entry>STRING DATA RIGHT TRUNCATION</entry>
<entry>string_data_right_truncation</entry>
</row>

<row>
<entry><literal>22011</literal></entry>
<entry>SUBSTRING ERROR</entry>
<entry>substring_error</entry>
</row>

<row>
<entry><literal>22027</literal></entry>
<entry>TRIM ERROR</entry>
<entry>trim_error</entry>
</row>

<row>
<entry><literal>22024</literal></entry>
<entry>UNTERMINATED C STRING</entry>
<entry>unterminated_c_string</entry>
</row>

<row>
<entry><literal>2200F</literal></entry>
<entry>ZERO LENGTH CHARACTER STRING</entry>
<entry>zero_length_character_string</entry>
</row>

<row>
<entry><literal>22P01</literal></entry>
<entry>FLOATING POINT EXCEPTION</entry>
<entry>floating_point_exception</entry>
</row>

<row>
<entry><literal>22P02</literal></entry>
<entry>INVALID TEXT REPRESENTATION</entry>
<entry>invalid_text_representation</entry>
</row>

<row>
<entry><literal>22P03</literal></entry>
<entry>INVALID BINARY REPRESENTATION</entry>
<entry>invalid_binary_representation</entry>
</row>

<row>
<entry><literal>22P04</literal></entry>
<entry>BAD COPY FILE FORMAT</entry>
<entry>bad_copy_file_format</entry>
</row>

<row>
<entry><literal>22P05</literal></entry>
<entry>UNTRANSLATABLE CHARACTER</entry>
<entry>untranslatable_character</entry>
</row>

<row>
<entry><literal>2200L</literal></entry>
<entry>NOT AN XML DOCUMENT</entry>
<entry>not_an_xml_document</entry>
</row>

<row>
<entry><literal>2200M</literal></entry>
<entry>INVALID XML DOCUMENT</entry>
<entry>invalid_xml_document</entry>
</row>

<row>
<entry><literal>2200N</literal></entry>
<entry>INVALID XML CONTENT</entry>
<entry>invalid_xml_content</entry>
</row>

<row>
<entry><literal>2200S</literal></entry>
<entry>INVALID XML COMMENT</entry>
<entry>invalid_xml_comment</entry>
</row>

<row>
<entry><literal>2200T</literal></entry>
<entry>INVALID XML PROCESSING INSTRUCTION</entry>
<entry>invalid_xml_processing_instruction</entry>
</row>

<row>
<entry spanname="span13"><emphasis role="bold">Class 23 &mdash; Integrity Constraint Violation</></entry>
</row>

<row>
<entry><literal>23000</literal></entry>
<entry>INTEGRITY CONSTRAINT VIOLATION</entry>
<entry>integrity_constraint_violation</entry>
</row>

<row>
<entry><literal>23001</literal></entry>
<entry>RESTRICT VIOLATION</entry>
<entry>restrict_violation</entry>
</row>

<row>
<entry><literal>23502</literal></entry>
<entry>NOT NULL VIOLATION</entry>
<entry>not_null_violation</entry>
</row>

<row>
<entry><literal>23503</literal></entry>
<entry>FOREIGN KEY VIOLATION</entry>
<entry>foreign_key_violation</entry>
</row>

<row>
<entry><literal>23505</literal></entry>
<entry>UNIQUE VIOLATION</entry>
<entry>unique_violation</entry>
</row>

<row>
<entry><literal>23514</literal></entry>
<entry>CHECK VIOLATION</entry>
<entry>check_violation</entry>
</row>

<row>
<entry><literal>23P01</literal></entry>
<entry>EXCLUSION VIOLATION</entry>
<entry>exclusion_violation</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 24 &mdash; Invalid Cursor State</></entry>
</row>

<row>
<entry><literal>24000</literal></entry>
<entry>INVALID CURSOR STATE</entry>
<entry>invalid_cursor_state</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 25 &mdash; Invalid Transaction State</></entry>
</row>

<row>
<entry><literal>25000</literal></entry>
<entry>INVALID TRANSACTION STATE</entry>
<entry>invalid_transaction_state</entry>
</row>

<row>
<entry><literal>25001</literal></entry>
<entry>ACTIVE SQL TRANSACTION</entry>
<entry>active_sql_transaction</entry>
</row>

<row>
<entry><literal>25002</literal></entry>
<entry>BRANCH TRANSACTION ALREADY ACTIVE</entry>
<entry>branch_transaction_already_active</entry>
</row>

<row>
<entry><literal>25008</literal></entry>
<entry>HELD CURSOR REQUIRES SAME ISOLATION LEVEL</entry>
<entry>held_cursor_requires_same_isolation_level</entry>
</row>

<row>
<entry><literal>25003</literal></entry>
<entry>INAPPROPRIATE ACCESS MODE FOR BRANCH TRANSACTION</entry>
<entry>inappropriate_access_mode_for_branch_transaction</entry>
</row>

<row>
<entry><literal>25004</literal></entry>
<entry>INAPPROPRIATE ISOLATION LEVEL FOR BRANCH TRANSACTION</entry>
<entry>inappropriate_isolation_level_for_branch_transaction</entry>
</row>

<row>
<entry><literal>25005</literal></entry>
<entry>NO ACTIVE SQL TRANSACTION FOR BRANCH TRANSACTION</entry>
<entry>no_active_sql_transaction_for_branch_transaction</entry>
</row>

<row>
<entry><literal>25006</literal></entry>
<entry>READ ONLY SQL TRANSACTION</entry>
<entry>read_only_sql_transaction</entry>
</row>

<row>
<entry><literal>25007</literal></entry>
<entry>SCHEMA AND DATA STATEMENT MIXING NOT SUPPORTED</entry>
<entry>schema_and_data_statement_mixing_not_supported</entry>
</row>

<row>
<entry><literal>25P01</literal></entry>
<entry>NO ACTIVE SQL TRANSACTION</entry>
<entry>no_active_sql_transaction</entry>
</row>

<row>
<entry><literal>25P02</literal></entry>
<entry>IN FAILED SQL TRANSACTION</entry>
<entry>in_failed_sql_transaction</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 26 &mdash; Invalid SQL Statement Name</></entry>
</row>

<row>
<entry><literal>26000</literal></entry>
<entry>INVALID SQL STATEMENT NAME</entry>
<entry>invalid_sql_statement_name</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 27 &mdash; Triggered Data Change Violation</></entry>
</row>

<row>
<entry><literal>27000</literal></entry>
<entry>TRIGGERED DATA CHANGE VIOLATION</entry>
<entry>triggered_data_change_violation</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 28 &mdash; Invalid Authorization Specification</></entry>
</row>

<row>
<entry><literal>28000</literal></entry>
<entry>INVALID AUTHORIZATION SPECIFICATION</entry>
<entry>invalid_authorization_specification</entry>
</row>

<row>
<entry><literal>28P01</literal></entry>
<entry>INVALID PASSWORD</entry>
<entry>invalid_password</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 2B &mdash; Dependent Privilege Descriptors Still Exist</></entry>
</row>

<row>
<entry><literal>2B000</literal></entry>
<entry>DEPENDENT PRIVILEGE DESCRIPTORS STILL EXIST</entry>
<entry>dependent_privilege_descriptors_still_exist</entry>
</row>

<row>
<entry><literal>2BP01</literal></entry>
<entry>DEPENDENT OBJECTS STILL EXIST</entry>
<entry>dependent_objects_still_exist</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 2D &mdash; Invalid Transaction Termination</></entry>
</row>

<row>
<entry><literal>2D000</literal></entry>
<entry>INVALID TRANSACTION TERMINATION</entry>
<entry>invalid_transaction_termination</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 2F &mdash; SQL Routine Exception</></entry>
</row>

<row>
<entry><literal>2F000</literal></entry>
<entry>SQL ROUTINE EXCEPTION</entry>
<entry>sql_routine_exception</entry>
</row>

<row>
<entry><literal>2F005</literal></entry>
<entry>FUNCTION EXECUTED NO RETURN STATEMENT</entry>
<entry>function_executed_no_return_statement</entry>
</row>

<row>
<entry><literal>2F002</literal></entry>
<entry>MODIFYING SQL DATA NOT PERMITTED</entry>
<entry>modifying_sql_data_not_permitted</entry>
</row>

<row>
<entry><literal>2F003</literal></entry>
<entry>PROHIBITED SQL STATEMENT ATTEMPTED</entry>
<entry>prohibited_sql_statement_attempted</entry>
</row>

<row>
<entry><literal>2F004</literal></entry>
<entry>READING SQL DATA NOT PERMITTED</entry>
<entry>reading_sql_data_not_permitted</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 34 &mdash; Invalid Cursor Name</></entry>
</row>

<row>
<entry><literal>34000</literal></entry>
<entry>INVALID CURSOR NAME</entry>
<entry>invalid_cursor_name</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 38 &mdash; External Routine Exception</></entry>
</row>

<row>
<entry><literal>38000</literal></entry>
<entry>EXTERNAL ROUTINE EXCEPTION</entry>
<entry>external_routine_exception</entry>
</row>

<row>
<entry><literal>38001</literal></entry>
<entry>CONTAINING SQL NOT PERMITTED</entry>
<entry>containing_sql_not_permitted</entry>
</row>

<row>
<entry><literal>38002</literal></entry>
<entry>MODIFYING SQL DATA NOT PERMITTED</entry>
<entry>modifying_sql_data_not_permitted</entry>
</row>

<row>
<entry><literal>38003</literal></entry>
<entry>PROHIBITED SQL STATEMENT ATTEMPTED</entry>
<entry>prohibited_sql_statement_attempted</entry>
</row>

<row>
<entry><literal>38004</literal></entry>
<entry>READING SQL DATA NOT PERMITTED</entry>
<entry>reading_sql_data_not_permitted</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 39 &mdash; External Routine Invocation Exception</></entry>
</row>

<row>
<entry><literal>39000</literal></entry>
<entry>EXTERNAL ROUTINE INVOCATION EXCEPTION</entry>
<entry>external_routine_invocation_exception</entry>
</row>

<row>
<entry><literal>39001</literal></entry>
<entry>INVALID SQLSTATE RETURNED</entry>
<entry>invalid_sqlstate_returned</entry>
</row>

<row>
<entry><literal>39004</literal></entry>
<entry>NULL VALUE NOT ALLOWED</entry>
<entry>null_value_not_allowed</entry>
</row>

<row>
<entry><literal>39P01</literal></entry>
<entry>TRIGGER PROTOCOL VIOLATED</entry>
<entry>trigger_protocol_violated</entry>
</row>

<row>
<entry><literal>39P02</literal></entry>
<entry>SRF PROTOCOL VIOLATED</entry>
<entry>srf_protocol_violated</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 3B &mdash; Savepoint Exception</></entry>
</row>

<row>
<entry><literal>3B000</literal></entry>
<entry>SAVEPOINT EXCEPTION</entry>
<entry>savepoint_exception</entry>
</row>

<row>
<entry><literal>3B001</literal></entry>
<entry>INVALID SAVEPOINT SPECIFICATION</entry>
<entry>invalid_savepoint_specification</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 3D &mdash; Invalid Catalog Name</></entry>
</row>

<row>
<entry><literal>3D000</literal></entry>
<entry>INVALID CATALOG NAME</entry>
<entry>invalid_catalog_name</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 3F &mdash; Invalid Schema Name</></entry>
</row>

<row>
<entry><literal>3F000</literal></entry>
<entry>INVALID SCHEMA NAME</entry>
<entry>invalid_schema_name</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 40 &mdash; Transaction Rollback</></entry>
</row>

<row>
<entry><literal>40000</literal></entry>
<entry>TRANSACTION ROLLBACK</entry>
<entry>transaction_rollback</entry>
</row>

<row>
<entry><literal>40002</literal></entry>
<entry>TRANSACTION INTEGRITY CONSTRAINT VIOLATION</entry>
<entry>transaction_integrity_constraint_violation</entry>
</row>

<row>
<entry><literal>40001</literal></entry>
<entry>SERIALIZATION FAILURE</entry>
<entry>serialization_failure</entry>
</row>

<row>
<entry><literal>40003</literal></entry>
<entry>STATEMENT COMPLETION UNKNOWN</entry>
<entry>statement_completion_unknown</entry>
</row>

<row>
<entry><literal>40P01</literal></entry>
<entry>DEADLOCK DETECTED</entry>
<entry>deadlock_detected</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 42 &mdash; Syntax Error or Access Rule Violation</></entry>
</row>

<row>
<entry><literal>42000</literal></entry>
<entry>SYNTAX ERROR OR ACCESS RULE VIOLATION</entry>
<entry>syntax_error_or_access_rule_violation</entry>
</row>

<row>
<entry><literal>42601</literal></entry>
<entry>SYNTAX ERROR</entry>
<entry>syntax_error</entry>
</row>

<row>
<entry><literal>42501</literal></entry>
<entry>INSUFFICIENT PRIVILEGE</entry>
<entry>insufficient_privilege</entry>
</row>

<row>
<entry><literal>42846</literal></entry>
<entry>CANNOT COERCE</entry>
<entry>cannot_coerce</entry>
</row>

<row>
<entry><literal>42803</literal></entry>
<entry>GROUPING ERROR</entry>
<entry>grouping_error</entry>
</row>

<row>
<entry><literal>42P20</literal></entry>
<entry>WINDOWING ERROR</entry>
<entry>windowing_error</entry>
</row>

<row>
<entry><literal>42P19</literal></entry>
<entry>INVALID RECURSION</entry>
<entry>invalid_recursion</entry>
</row>

<row>
<entry><literal>42830</literal></entry>
<entry>INVALID FOREIGN KEY</entry>
<entry>invalid_foreign_key</entry>
</row>

<row>
<entry><literal>42602</literal></entry>
<entry>INVALID NAME</entry>
<entry>invalid_name</entry>
</row>

<row>
<entry><literal>42622</literal></entry>
<entry>NAME TOO LONG</entry>
<entry>name_too_long</entry>
</row>

<row>
<entry><literal>42939</literal></entry>
<entry>RESERVED NAME</entry>
<entry>reserved_name</entry>
</row>

<row>
<entry><literal>42804</literal></entry>
<entry>DATATYPE MISMATCH</entry>
<entry>datatype_mismatch</entry>
</row>

<row>
<entry><literal>42P18</literal></entry>
<entry>INDETERMINATE DATATYPE</entry>
<entry>indeterminate_datatype</entry>
</row>

<row>
<entry><literal>42809</literal></entry>
<entry>WRONG OBJECT TYPE</entry>
<entry>wrong_object_type</entry>
</row>

<row>
<entry><literal>42703</literal></entry>
<entry>UNDEFINED COLUMN</entry>
<entry>undefined_column</entry>
</row>

<row>
<entry><literal>42883</literal></entry>
<entry>UNDEFINED FUNCTION</entry>
<entry>undefined_function</entry>
</row>

<row>
<entry><literal>42P01</literal></entry>
<entry>UNDEFINED TABLE</entry>
<entry>undefined_table</entry>
</row>

<row>
<entry><literal>42P02</literal></entry>
<entry>UNDEFINED PARAMETER</entry>
<entry>undefined_parameter</entry>
</row>

<row>
<entry><literal>42704</literal></entry>
<entry>UNDEFINED OBJECT</entry>
<entry>undefined_object</entry>
</row>

<row>
<entry><literal>42701</literal></entry>
<entry>DUPLICATE COLUMN</entry>
<entry>duplicate_column</entry>
</row>

<row>
<entry><literal>42P03</literal></entry>
<entry>DUPLICATE CURSOR</entry>
<entry>duplicate_cursor</entry>
</row>

<row>
<entry><literal>42P04</literal></entry>
<entry>DUPLICATE DATABASE</entry>
<entry>duplicate_database</entry>
</row>

<row>
<entry><literal>42723</literal></entry>
<entry>DUPLICATE FUNCTION</entry>
<entry>duplicate_function</entry>
</row>

<row>
<entry><literal>42P05</literal></entry>
<entry>DUPLICATE PREPARED STATEMENT</entry>
<entry>duplicate_prepared_statement</entry>
</row>

<row>
<entry><literal>42P06</literal></entry>
<entry>DUPLICATE SCHEMA</entry>
<entry>duplicate_schema</entry>
</row>

<row>
<entry><literal>42P07</literal></entry>
<entry>DUPLICATE TABLE</entry>
<entry>duplicate_table</entry>
</row>

<row>
<entry><literal>42712</literal></entry>
<entry>DUPLICATE ALIAS</entry>
<entry>duplicate_alias</entry>
</row>

<row>
<entry><literal>42710</literal></entry>
<entry>DUPLICATE OBJECT</entry>
<entry>duplicate_object</entry>
</row>

<row>
<entry><literal>42702</literal></entry>
<entry>AMBIGUOUS COLUMN</entry>
<entry>ambiguous_column</entry>
</row>

<row>
<entry><literal>42725</literal></entry>
<entry>AMBIGUOUS FUNCTION</entry>
<entry>ambiguous_function</entry>
</row>

<row>
<entry><literal>42P08</literal></entry>
<entry>AMBIGUOUS PARAMETER</entry>
<entry>ambiguous_parameter</entry>
</row>

<row>
<entry><literal>42P09</literal></entry>
<entry>AMBIGUOUS ALIAS</entry>
<entry>ambiguous_alias</entry>
</row>

<row>
<entry><literal>42P10</literal></entry>
<entry>INVALID COLUMN REFERENCE</entry>
<entry>invalid_column_reference</entry>
</row>

<row>
<entry><literal>42611</literal></entry>
<entry>INVALID COLUMN DEFINITION</entry>
<entry>invalid_column_definition</entry>
</row>

<row>
<entry><literal>42P11</literal></entry>
<entry>INVALID CURSOR DEFINITION</entry>
<entry>invalid_cursor_definition</entry>
</row>

<row>
<entry><literal>42P12</literal></entry>
<entry>INVALID DATABASE DEFINITION</entry>
<entry>invalid_database_definition</entry>
</row>

<row>
<entry><literal>42P13</literal></entry>
<entry>INVALID FUNCTION DEFINITION</entry>
<entry>invalid_function_definition</entry>
</row>

<row>
<entry><literal>42P14</literal></entry>
<entry>INVALID PREPARED STATEMENT DEFINITION</entry>
<entry>invalid_prepared_statement_definition</entry>
</row>

<row>
<entry><literal>42P15</literal></entry>
<entry>INVALID SCHEMA DEFINITION</entry>
<entry>invalid_schema_definition</entry>
</row>

<row>
<entry><literal>42P16</literal></entry>
<entry>INVALID TABLE DEFINITION</entry>
<entry>invalid_table_definition</entry>
</row>

<row>
<entry><literal>42P17</literal></entry>
<entry>INVALID OBJECT DEFINITION</entry>
<entry>invalid_object_definition</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 44 &mdash; WITH CHECK OPTION Violation</></entry>
</row>

<row>
<entry><literal>44000</literal></entry>
<entry>WITH CHECK OPTION VIOLATION</entry>
<entry>with_check_option_violation</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 53 &mdash; Insufficient Resources</></entry>
</row>

<row>
<entry><literal>53000</literal></entry>
<entry>INSUFFICIENT RESOURCES</entry>
<entry>insufficient_resources</entry>
</row>

<row>
<entry><literal>53100</literal></entry>
<entry>DISK FULL</entry>
<entry>disk_full</entry>
</row>

<row>
<entry><literal>53200</literal></entry>
<entry>OUT OF MEMORY</entry>
<entry>out_of_memory</entry>
</row>

<row>
<entry><literal>53300</literal></entry>
<entry>TOO MANY CONNECTIONS</entry>
<entry>too_many_connections</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 54 &mdash; Program Limit Exceeded</></entry>
</row>

<row>
<entry><literal>54000</literal></entry>
<entry>PROGRAM LIMIT EXCEEDED</entry>
<entry>program_limit_exceeded</entry>
</row>

<row>
<entry><literal>54001</literal></entry>
<entry>STATEMENT TOO COMPLEX</entry>
<entry>statement_too_complex</entry>
</row>

<row>
<entry><literal>54011</literal></entry>
<entry>TOO MANY COLUMNS</entry>
<entry>too_many_columns</entry>
</row>

<row>
<entry><literal>54023</literal></entry>
<entry>TOO MANY ARGUMENTS</entry>
<entry>too_many_arguments</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 55 &mdash; Object Not In Prerequisite State</></entry>
</row>

<row>
<entry><literal>55000</literal></entry>
<entry>OBJECT NOT IN PREREQUISITE STATE</entry>
<entry>object_not_in_prerequisite_state</entry>
</row>

<row>
<entry><literal>55006</literal></entry>
<entry>OBJECT IN USE</entry>
<entry>object_in_use</entry>
</row>

<row>
<entry><literal>55P02</literal></entry>
<entry>CANT CHANGE RUNTIME PARAM</entry>
<entry>cant_change_runtime_param</entry>
</row>

<row>
<entry><literal>55P03</literal></entry>
<entry>LOCK NOT AVAILABLE</entry>
<entry>lock_not_available</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 57 &mdash; Operator Intervention</></entry>
</row>

<row>
<entry><literal>57000</literal></entry>
<entry>OPERATOR INTERVENTION</entry>
<entry>operator_intervention</entry>
</row>

<row>
<entry><literal>57014</literal></entry>
<entry>QUERY CANCELED</entry>
<entry>query_canceled</entry>
</row>

<row>
<entry><literal>57P01</literal></entry>
<entry>ADMIN SHUTDOWN</entry>
<entry>admin_shutdown</entry>
</row>

<row>
<entry><literal>57P02</literal></entry>
<entry>CRASH SHUTDOWN</entry>
<entry>crash_shutdown</entry>
</row>

<row>
<entry><literal>57P03</literal></entry>
<entry>CANNOT CONNECT NOW</entry>
<entry>cannot_connect_now</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class 58 &mdash; System Error (errors external to <productname>PostgreSQL</> itself)</></entry>
</row>

<row>
<entry><literal>58030</literal></entry>
<entry>IO ERROR</entry>
<entry>io_error</entry>
</row>

<row>
<entry><literal>58P01</literal></entry>
<entry>UNDEFINED FILE</entry>
<entry>undefined_file</entry>
</row>

<row>
<entry><literal>58P02</literal></entry>
<entry>DUPLICATE FILE</entry>
<entry>duplicate_file</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class F0 &mdash; Configuration File Error</></entry>
</row>

<row>
<entry><literal>F0000</literal></entry>
<entry>CONFIG FILE ERROR</entry>
<entry>config_file_error</entry>
</row>

<row>
<entry><literal>F0001</literal></entry>
<entry>LOCK FILE EXISTS</entry>
<entry>lock_file_exists</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class HV &mdash; Foreign Data Wrapper Error (SQL/MED)</></entry>
</row>

<row>
<entry><literal>HV000</literal></entry>
<entry>FDW ERROR</entry>
<entry>fdw_error</entry>
</row>

<row>
<entry><literal>HV005</literal></entry>
<entry>FDW COLUMN NAME NOT FOUND</entry>
<entry>fdw_column_name_not_found</entry>
</row>

<row>
<entry><literal>HV002</literal></entry>
<entry>FDW DYNAMIC PARAMETER VALUE NEEDED</entry>
<entry>fdw_dynamic_parameter_value_needed</entry>
</row>

<row>
<entry><literal>HV010</literal></entry>
<entry>FDW FUNCTION SEQUENCE ERROR</entry>
<entry>fdw_function_sequence_error</entry>
</row>

<row>
<entry><literal>HV021</literal></entry>
<entry>FDW INCONSISTENT DESCRIPTOR INFORMATION</entry>
<entry>fdw_inconsistent_descriptor_information</entry>
</row>

<row>
<entry><literal>HV024</literal></entry>
<entry>FDW INVALID ATTRIBUTE VALUE</entry>
<entry>fdw_invalid_attribute_value</entry>
</row>

<row>
<entry><literal>HV007</literal></entry>
<entry>FDW INVALID COLUMN NAME</entry>
<entry>fdw_invalid_column_name</entry>
</row>

<row>
<entry><literal>HV008</literal></entry>
<entry>FDW INVALID COLUMN NUMBER</entry>
<entry>fdw_invalid_column_number</entry>
</row>

<row>
<entry><literal>HV004</literal></entry>
<entry>FDW INVALID DATA TYPE</entry>
<entry>fdw_invalid_data_type</entry>
</row>

<row>
<entry><literal>HV006</literal></entry>
<entry>FDW INVALID DATA TYPE DESCRIPTORS</entry>
<entry>fdw_invalid_data_type_descriptors</entry>
</row>

<row>
<entry><literal>HV091</literal></entry>
<entry>FDW INVALID DESCRIPTOR FIELD IDENTIFIER</entry>
<entry>fdw_invalid_descriptor_field_identifier</entry>
</row>

<row>
<entry><literal>HV00B</literal></entry>
<entry>FDW INVALID HANDLE</entry>
<entry>fdw_invalid_handle</entry>
</row>

<row>
<entry><literal>HV00C</literal></entry>
<entry>FDW INVALID OPTION INDEX</entry>
<entry>fdw_invalid_option_index</entry>
</row>

<row>
<entry><literal>HV00D</literal></entry>
<entry>FDW INVALID OPTION NAME</entry>
<entry>fdw_invalid_option_name</entry>
</row>

<row>
<entry><literal>HV090</literal></entry>
<entry>FDW INVALID STRING LENGTH OR BUFFER LENGTH</entry>
<entry>fdw_invalid_string_length_or_buffer_length</entry>
</row>

<row>
<entry><literal>HV00A</literal></entry>
<entry>FDW INVALID STRING FORMAT</entry>
<entry>fdw_invalid_string_format</entry>
</row>

<row>
<entry><literal>HV009</literal></entry>
<entry>FDW INVALID USE OF NULL POINTER</entry>
<entry>fdw_invalid_use_of_null_pointer</entry>
</row>

<row>
<entry><literal>HV014</literal></entry>
<entry>FDW TOO MANY HANDLES</entry>
<entry>fdw_too_many_handles</entry>
</row>

<row>
<entry><literal>HV001</literal></entry>
<entry>FDW OUT OF MEMORY</entry>
<entry>fdw_out_of_memory</entry>
</row>

<row>
<entry><literal>HV00P</literal></entry>
<entry>FDW NO SCHEMAS</entry>
<entry>fdw_no_schemas</entry>
</row>

<row>
<entry><literal>HV00J</literal></entry>
<entry>FDW OPTION NAME NOT FOUND</entry>
<entry>fdw_option_name_not_found</entry>
</row>

<row>
<entry><literal>HV00K</literal></entry>
<entry>FDW REPLY HANDLE</entry>
<entry>fdw_reply_handle</entry>
</row>

<row>
<entry><literal>HV00Q</literal></entry>
<entry>FDW SCHEMA NOT FOUND</entry>
<entry>fdw_schema_not_found</entry>
</row>

<row>
<entry><literal>HV00R</literal></entry>
<entry>FDW TABLE NOT FOUND</entry>
<entry>fdw_table_not_found</entry>
</row>

<row>
<entry><literal>HV00L</literal></entry>
<entry>FDW UNABLE TO CREATE EXECUTION</entry>
<entry>fdw_unable_to_create_execution</entry>
</row>

<row>
<entry><literal>HV00M</literal></entry>
<entry>FDW UNABLE TO CREATE REPLY</entry>
<entry>fdw_unable_to_create_reply</entry>
</row>

<row>
<entry><literal>HV00N</literal></entry>
<entry>FDW UNABLE TO ESTABLISH CONNECTION</entry>
<entry>fdw_unable_to_establish_connection</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class P0 &mdash; PL/pgSQL Error</></entry>
</row>

<row>
<entry><literal>P0000</literal></entry>
<entry>PLPGSQL ERROR</entry>
<entry>plpgsql_error</entry>
</row>

<row>
<entry><literal>P0001</literal></entry>
<entry>RAISE EXCEPTION</entry>
<entry>raise_exception</entry>
</row>

<row>
<entry><literal>P0002</literal></entry>
<entry>NO DATA FOUND</entry>
<entry>no_data_found</entry>
</row>

<row>
<entry><literal>P0003</literal></entry>
<entry>TOO MANY ROWS</entry>
<entry>too_many_rows</entry>
</row>


<row>
<entry spanname="span13"><emphasis role="bold">Class XX &mdash; Internal Error</></entry>
</row>

<row>
<entry><literal>XX000</literal></entry>
<entry>INTERNAL ERROR</entry>
<entry>internal_error</entry>
</row>

<row>
<entry><literal>XX001</literal></entry>
<entry>DATA CORRUPTED</entry>
<entry>data_corrupted</entry>
</row>

<row>
<entry><literal>XX002</literal></entry>
<entry>INDEX CORRUPTED</entry>
<entry>index_corrupted</entry>
</row>

  </tbody>
 </tgroup>
</table>


</appendix>
