Annexe A. Codes d'erreurs de PostgreSQL

Tous les messages émis par le serveur PostgreSQL se voient affectés des codes d'erreur sur cinq caractères suivant les conventions du standard SQL pour les codes << SQLSTATE >>. Les applications qui ont besoin de savoir quelle condition d'erreur est survenue devraient normalement tester le code d'erreur plutôt que de chercher le message d'erreur textuel. Les codes d'erreurs sont moins sujets à changement suivant les versions de PostgreSQL et ne sont pas sujets aux changements dû à la localisation des messages d'erreurs.

Suivant le standard, les deux premiers caractères d'un code d'erreur dénote une classe d'erreurs alors que les trois derniers indiquent une condition spécifique à l'intérieur de cette classe. Du coup, une application ne reconnaissant pas le code d'erreur spécifique pourrait toujours être capable d'inférer ce qu'il convient de faire d'après la classe de l'erreur.

Tableau A-1 liste tous les codes d'erreurs définis dans PostgreSQL 7.4.29. (Certains ne sont pas réellement utilisés mais sont définis par le standard SQL.) Les classes d'erreurs sont aussi affichées. Pour chaque classe d'erreur, il y a un code d'erreur << standard >> ayant les trois derniers caractères 000. Ce code est utilisé seulement pour les conditions d'erreurs qui tombent dans la classe mais n'ont pas de code plus spécifique affecté.

Tableau A-1. Codes d'erreurs PostgreSQL

Code d'erreurSignification
Class 00Successful Completion
00000SUCCESSFUL COMPLETION
Class 01Warning
01000WARNING
0100CWARNING DYNAMIC RESULT SETS RETURNED
01008WARNING IMPLICIT ZERO BIT PADDING
01003WARNING NULL VALUE ELIMINATED IN SET FUNCTION
01004WARNING STRING DATA RIGHT TRUNCATION
Class 02No Data --- this is also a warning class per SQL99
02000NO DATA
02001NO ADDITIONAL DYNAMIC RESULT SETS RETURNED
Class 03SQL Statement Not Yet Complete
03000SQL STATEMENT NOT YET COMPLETE
Class 08Connection Exception
08000CONNECTION EXCEPTION
08003CONNECTION DOES NOT EXIST
08006CONNECTION FAILURE
08001SQLCLIENT UNABLE TO ESTABLISH SQLCONNECTION
08004SQLSERVER REJECTED ESTABLISHMENT OF SQLCONNECTION
08007TRANSACTION RESOLUTION UNKNOWN
08P01PROTOCOL VIOLATION
Class 09Triggered Action Exception
09000TRIGGERED ACTION EXCEPTION
Class 0AFeature Not Supported
0A000FEATURE NOT SUPPORTED
Class 0BInvalid Transaction Initiation
0B000INVALID TRANSACTION INITIATION
Class 0FLocator Exception
0F000LOCATOR EXCEPTION
0F001INVALID SPECIFICATION
Class 0LInvalid Grantor
0L000INVALID GRANTOR
0LP01INVALID GRANT OPERATION
Class 0PInvalid Role Specification
0P000INVALID ROLE SPECIFICATION
Class 21Cardinality Violation
21000CARDINALITY VIOLATION
Class 22Data Exception
22000DATA EXCEPTION
2202EARRAY ELEMENT ERROR
22021CHARACTER NOT IN REPERTOIRE
22008DATETIME FIELD OVERFLOW
22012DIVISION BY ZERO
22005ERROR IN ASSIGNMENT
2200BESCAPE CHARACTER CONFLICT
22022INDICATOR OVERFLOW
22015INTERVAL FIELD OVERFLOW
22018INVALID CHARACTER VALUE FOR CAST
22007INVALID DATETIME FORMAT
22019INVALID ESCAPE CHARACTER
2200DINVALID ESCAPE OCTET
22025INVALID ESCAPE SEQUENCE
22010INVALID INDICATOR PARAMETER VALUE
22020INVALID LIMIT VALUE
22023INVALID PARAMETER VALUE
2201BINVALID REGULAR EXPRESSION
22009INVALID TIME ZONE DISPLACEMENT VALUE
2200CINVALID USE OF ESCAPE CHARACTER
2200GMOST SPECIFIC TYPE MISMATCH
22004NULL VALUE NOT ALLOWED
22002NULL VALUE NO INDICATOR PARAMETER
22003NUMERIC VALUE OUT OF RANGE
22026STRING DATA LENGTH MISMATCH
22001STRING DATA RIGHT TRUNCATION
22011SUBSTRING ERROR
22027TRIM ERROR
22024UNTERMINATED C STRING
2200FZERO LENGTH CHARACTER STRING
22P01FLOATING POINT EXCEPTION
22P02INVALID TEXT REPRESENTATION
22P03INVALID BINARY REPRESENTATION
22P04BAD COPY FILE FORMAT
22P05UNTRANSLATABLE CHARACTER
Class 23Integrity Constraint Violation
23000INTEGRITY CONSTRAINT VIOLATION
23001RESTRICT VIOLATION
23502NOT NULL VIOLATION
23503FOREIGN KEY VIOLATION
23505UNIQUE VIOLATION
23514CHECK VIOLATION
Class 24Invalid Cursor State
24000INVALID CURSOR STATE
Class 25Invalid Transaction State
25000INVALID TRANSACTION STATE
25001ACTIVE SQL TRANSACTION
25002BRANCH TRANSACTION ALREADY ACTIVE
25008HELD CURSOR REQUIRES SAME ISOLATION LEVEL
25003INAPPROPRIATE ACCESS MODE FOR BRANCH TRANSACTION
25004INAPPROPRIATE ISOLATION LEVEL FOR BRANCH TRANSACTION
25005NO ACTIVE SQL TRANSACTION FOR BRANCH TRANSACTION
25006READ ONLY SQL TRANSACTION
25007SCHEMA AND DATA STATEMENT MIXING NOT SUPPORTED
25P01NO ACTIVE SQL TRANSACTION
25P02IN FAILED SQL TRANSACTION
Class 26Invalid SQL Statement Name
26000INVALID SQL STATEMENT NAME
Class 27Triggered Data Change Violation
27000TRIGGERED DATA CHANGE VIOLATION
Class 28Invalid Authorization Specification
28000INVALID AUTHORIZATION SPECIFICATION
Class 2BDependent Privilege Descriptors Still Exist
2B000DEPENDENT PRIVILEGE DESCRIPTORS STILL EXIST
2BP01DEPENDENT OBJECTS STILL EXIST
Class 2DInvalid Transaction Termination
2D000INVALID TRANSACTION TERMINATION
Class 2FSQL Routine Exception
2F000SQL ROUTINE EXCEPTION
2F005FUNCTION EXECUTED NO RETURN STATEMENT
2F002MODIFYING SQL DATA NOT PERMITTED
2F003PROHIBITED SQL STATEMENT ATTEMPTED
2F004READING SQL DATA NOT PERMITTED
Class 34Invalid Cursor Name
34000INVALID CURSOR NAME
Class 38External Routine Exception
38000EXTERNAL ROUTINE EXCEPTION
38001CONTAINING SQL NOT PERMITTED
38002MODIFYING SQL DATA NOT PERMITTED
38003PROHIBITED SQL STATEMENT ATTEMPTED
38004READING SQL DATA NOT PERMITTED
Class 39External Routine Invocation Exception
39000EXTERNAL ROUTINE INVOCATION EXCEPTION
39001INVALID SQLSTATE RETURNED
39004NULL VALUE NOT ALLOWED
39P01TRIGGER PROTOCOL VIOLATED
39P02SRF PROTOCOL VIOLATED
Class 3DInvalid Catalog Name
3D000INVALID CATALOG NAME
Class 3FInvalid Schema Name
3F000INVALID SCHEMA NAME
Class 40Transaction Rollback
40000TRANSACTION ROLLBACK
40002INTEGRITY CONSTRAINT VIOLATION
40001SERIALIZATION FAILURE
40003STATEMENT COMPLETION UNKNOWN
40P01DEADLOCK DETECTED
Class 42Syntax Error or Access Rule Violation
42000SYNTAX ERROR OR ACCESS RULE VIOLATION
42601SYNTAX ERROR
42501INSUFFICIENT PRIVILEGE
42846CANNOT COERCE
42803GROUPING ERROR
42830INVALID FOREIGN KEY
42602INVALID NAME
42622NAME TOO LONG
42939RESERVED NAME
42804DATATYPE MISMATCH
42P18INDETERMINATE DATATYPE
42809WRONG OBJECT TYPE
42703UNDEFINED COLUMN
42883UNDEFINED FUNCTION
42P01UNDEFINED TABLE
42P02UNDEFINED PARAMETER
42704UNDEFINED OBJECT
42701DUPLICATE COLUMN
42P03DUPLICATE CURSOR
42P04DUPLICATE DATABASE
42723DUPLICATE FUNCTION
42P05DUPLICATE PSTATEMENT
42P06DUPLICATE SCHEMA
42P07DUPLICATE TABLE
42712DUPLICATE ALIAS
42710DUPLICATE OBJECT
42702AMBIGUOUS COLUMN
42725AMBIGUOUS FUNCTION
42P08AMBIGUOUS PARAMETER
42P09AMBIGUOUS ALIAS
42P10INVALID COLUMN REFERENCE
42611INVALID COLUMN DEFINITION
42P11INVALID CURSOR DEFINITION
42P12INVALID DATABASE DEFINITION
42P13INVALID FUNCTION DEFINITION
42P14INVALID PSTATEMENT DEFINITION
42P15INVALID SCHEMA DEFINITION
42P16INVALID TABLE DEFINITION
42P17INVALID OBJECT DEFINITION
Class 44WITH CHECK OPTION Violation
44000WITH CHECK OPTION VIOLATION
Class 53Insufficient Resources
53000INSUFFICIENT RESOURCES
53100DISK FULL
53200OUT OF MEMORY
53300TOO MANY CONNECTIONS
Class 54Program Limit Exceeded
54000PROGRAM LIMIT EXCEEDED
54001STATEMENT TOO COMPLEX
54011TOO MANY COLUMNS
54023TOO MANY ARGUMENTS
Class 55Object Not In Prerequisite State
55000OBJECT NOT IN PREREQUISITE STATE
55006OBJECT IN USE
55P02CANT CHANGE RUNTIME PARAM
Class 57Operator Intervention
57000OPERATOR INTERVENTION
57014QUERY CANCELED
57P01ADMIN SHUTDOWN
57P02CRASH SHUTDOWN
57P03CANNOT CONNECT NOW
Class 58System Error (errors external to PostgreSQL itself)
58030IO ERROR
58P01UNDEFINED FILE
58P02DUPLICATE FILE
Class F0Configuration File Error
F0000CONFIG FILE ERROR
F0001LOCK FILE EXISTS
Class XXInternal Error
XX000INTERNAL ERROR
XX001DATA CORRUPTED
XX002INDEX CORRUPTED