(correct format)
For easy COPY/PASTE, here goes (attached) a revisised "Table A-1. PostgreSQL
Error Codes" with a new column "Constant".
Best Regards.
Mensagem enviada pelo Webmail UENF: http://www.grc.uenf.br/webmail
PostgreSQL Error Codes
error codes
list of
All messages emitted by the PostgreSQL
server are assigned five-character error codes that follow the SQL
standard's conventions for 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
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 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.
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 may still be able to infer
what to do from the error class.
lists all the error codes defined in
PostgreSQL &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
standard error code having the last three characters
000. This code is used only for error conditions that fall
within the class but do not have any more-specific code assigned.
The 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 22012, DIVISION BY ZERO,
has condition name DIVISION_BY_ZERO. Condition names can
be written in either upper or lower case. (Note that
PL/pgSQL does not recognize warning, as opposed to error,
condition names; those are classes 00, 01, and 02.)
PostgreSQL Error Codes
Error Code
Meaning
Class 00
Successful Completion
0
SUCCESSFUL COMPLETION
successful_completion
Class 01
Warning
1000
WARNING
warning
0100C
DYNAMIC RESULT SETS RETURNED
dynamic_result_sets_returned
1008
IMPLICIT ZERO BIT PADDING
implicit_zero_bit_padding
1003
NULL VALUE ELIMINATED IN SET FUNCTION
null_value_eliminated_in_set_function
1007
PRIVILEGE NOT GRANTED
privilege_not_granted
1006
PRIVILEGE NOT REVOKED
privilege_not_revoked
1004
STRING DATA RIGHT TRUNCATION
string_data_right_truncation
01P01
DEPRECATED FEATURE
deprecated_feature
Class 02
No Data this is also a warning class per the SQL standard
2000
NO DATA
no_data
2001
NO ADDITIONAL DYNAMIC RESULT SETS RETURNED
no_additional_dynamic_result_sets_returned
Class 03
SQL Statement Not Yet Complete
3000
SQL STATEMENT NOT YET COMPLETE
sql_statement_not_yet_complete
Class 08
Connection Exception
8000
CONNECTION EXCEPTION
connection_exception
8003
CONNECTION DOES NOT EXIST
connection_does_not_exist
8006
CONNECTION FAILURE
connection_failure
8001
SQLCLIENT UNABLE TO ESTABLISH SQLCONNECTION
sqlclient_unable_to_establish_sqlconnection
8004
SQLSERVER REJECTED ESTABLISHMENT OF SQLCONNECTION
sqlserver_rejected_establishment_of_sqlconnection
8007
TRANSACTION RESOLUTION UNKNOWN
transaction_resolution_unknown
08P01
PROTOCOL VIOLATION
protocol_violation
Class 09
Triggered Action Exception
9000
TRIGGERED ACTION EXCEPTION
triggered_action_exception
Class 0A
Feature Not Supported
0A000
FEATURE NOT SUPPORTED
feature_not_supported
Class 0B
Invalid Transaction Initiation
0B000
INVALID TRANSACTION INITIATION
invalid_transaction_initiation
Class 0F
Locator Exception
0F000
LOCATOR EXCEPTION
locator_exception
0F001
INVALID LOCATOR SPECIFICATION
invalid_locator_specification
Class 0L
Invalid Grantor
0L000
INVALID GRANTOR
invalid_grantor
0LP01
INVALID GRANT OPERATION
invalid_grant_operation
Class 0P
Invalid Role Specification
0P000
INVALID ROLE SPECIFICATION
invalid_role_specification
Class 21
Cardinality Violation
21000
CARDINALITY VIOLATION
cardinality_violation
Class 22
Data Exception
22000
DATA EXCEPTION
data_exception
2202E
ARRAY SUBSCRIPT ERROR
array_subscript_error
22021
CHARACTER NOT IN REPERTOIRE
character_not_in_repertoire
22008
DATETIME FIELD OVERFLOW
datetime_field_overflow
22012
DIVISION BY ZERO
division_by_zero
22005
ERROR IN ASSIGNMENT
error_in_assignment
2200B
ESCAPE CHARACTER CONFLICT
escape_character_conflict
22022
INDICATOR OVERFLOW
indicator_overflow
22015
INTERVAL FIELD OVERFLOW
interval_field_overflow
2201E
INVALID ARGUMENT FOR LOGARITHM
invalid_argument_for_logarithm
22