All Products
Search
Document Center

AnalyticDB:Error codes

Last Updated:Mar 30, 2026

AnalyticDB for PostgreSQL assigns a five-character SQLSTATE error code to every message it returns. These codes follow the SQL standard: the first two characters identify the error class, and the last three identify the specific condition within that class. If your application encounters an unfamiliar code, it can still infer the general error category from the class prefix.

For some errors, the server also reports the name of the associated database object—such as a table, column, data type, or constraint—in a separate field of the error message. This means your application does not need to parse the human-readable message text to extract object names.

This document lists all error codes defined in PostgreSQL 8.1.

The Condition name column shows the symbolic name you use in PL/pgSQL exception handlers:

EXCEPTION
  WHEN division_by_zero THEN ...
  WHEN unique_violation THEN ...

Condition names are case-insensitive.

Error code Condition name Description
Class 00 — Successful completion
00000 successful_completion Successful operation
Class 01 — Warning
01000 warning Warning
0100C dynamic_result_sets_returned Dynamic result sets returned
01008 implicit_zero_bit_padding Value padded with zero bits
01003 null_value_eliminated_in_set_function NULL value eliminated in set function
01007 privilege_not_granted Required permissions not granted
01006 privilege_not_revoked Specified permissions not revoked
01004 string_data_right_truncation String truncated on the right
01P01 deprecated_feature Feature deprecated
Class 02 — No data (also a warning class as per the SQL standard)
02000 no_data No data returned
02001 no_additional_dynamic_result_sets_returned No additional dynamic result sets returned
Class 03 — SQL statement not yet complete
03000 sql_statement_not_yet_complete SQL statement execution not complete
Class 08 — Connection exception
08000 connection_exception Connection exception
08003 connection_does_not_exist Connection does not exist
08006 connection_failure Connection failure
08001 sqlclient_unable_to_establish_sqlconnection SQL client failed to establish connection
08004 sqlserver_rejected_establishment_of_sqlconnection SQL server rejected connection request
08007 transaction_resolution_unknown Transaction resolution unknown
08P01 protocol_violation Protocol violated
Class 09 — Triggered action exception
09000 triggered_action_exception Exception thrown by triggered action
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 Invalid array subscript
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 Internal field overflow
2201E invalid_argument_for_logarithm Invalid argument for logarithm
2201F invalid_argument_for_power_function Invalid argument for power function
2201G invalid_argument_for_width_bucket_function Invalid argument for WIDTH_BUCKET function
22018 invalid_character_value_for_cast Cast specification has invalid character value
22007 invalid_datetime_format Invalid datetime format
22019 invalid_escape_character Invalid escape character
2200D invalid_escape_octet Invalid escape octet
22025 invalid_escape_sequence Invalid escape sequence
22P06 nonstandard_use_of_escape_character Non-standard escape character used
22010 invalid_indicator_parameter_value Invalid indicator parameter value
22020 invalid_limit_value Invalid limit value
22023 invalid_parameter_value Invalid parameter value
2201B invalid_regular_expression Invalid regular expression
22009 invalid_time_zone_displacement_value Invalid time zone displacement value
2200C invalid_use_of_escape_character Invalid escape character used
2200G most_specific_type_mismatch Most relevant types do not match
22004 null_value_not_allowed NULL values not allowed
22002 null_value_no_indicator_parameter NULL value used for indicator parameter
22003 numeric_value_out_of_range Numeric value out of range
22026 string_data_length_mismatch String lengths do not match
22001 string_data_right_truncation String truncated on the right
22011 substring_error Substring error
22027 trim_error Truncation error
22024 unterminated_c_string C string not terminated
2200F zero_length_character_string Zero-length character string returned
22P01 floating_point_exception Floating point exception
22P02 invalid_text_representation Invalid text representation
22P03 invalid_binary_representation Invalid binary representation
22P04 bad_copy_file_format Invalid copy file format
22P05 untranslatable_character Untranslatable characters found
Class 23 — Integrity constraint violation
23000 integrity_constraint_violation Integrity constraint violated
23001 restrict_violation Restrict violation
23502 not_null_violation NOT NULL rule violated
23503 foreign_key_violation Foreign key constraint violated
23505 unique_violation Uniqueness constraint violated
23514 check_violation Check constraint violated
Class 24 — Invalid cursor state
24000 invalid_cursor_state Invalid cursor state
Class 25 — Invalid transaction state
25000 invalid_transaction_state Invalid transaction state
25001 active_sql_transaction Active SQL transaction
25002 branch_transaction_already_active Branch transaction already active
25008 held_cursor_requires_same_isolation_level Held cursors require the same isolation level
25003 inappropriate_access_mode_for_branch_transaction Inappropriate access mode for branch transaction
25004 inappropriate_isolation_level_for_branch_transaction Inappropriate isolation level for branch transaction
25005 no_active_sql_transaction_for_branch_transaction Branch transaction has no active SQL transaction
25006 read_only_sql_transaction SQL transaction is read-only
25007 schema_and_data_statement_mixing_not_supported Schema and data statements cannot be mixed
25P01 no_active_sql_transaction No active SQL transactions
25P02 in_failed_sql_transaction SQL transaction in failed state
Class 26 — Invalid SQL statement name
26000 invalid_sql_statement_name Invalid SQL statement name
Class 27 — Triggered data change violation
27000 triggered_data_change_violation Triggered data change violates constraints
Class 28 — Invalid authorization specification
28000 invalid_authorization_specification Invalid authorization specification
Class 2B — Dependent privilege descriptors still exist
2B000 dependent_privilege_descriptors_still_exist Dependent privilege descriptors still exist
2BP01 dependent_objects_still_exist Dependent objects still exist
Class 2D — Invalid transaction termination
2D000 invalid_transaction_termination Invalid transaction termination
Class 2F — SQL routine exception
2F000 sql_routine_exception SQL routine exception
2F005 function_executed_no_return_statement Executed function does not return statements
2F002 modifying_sql_data_not_permitted SQL data cannot be modified
2F003 prohibited_sql_statement_attempted Prohibited SQL statements attempted
2F004 reading_sql_data_not_permitted SQL data cannot be read
Class 34 — Invalid cursor name
34000 invalid_cursor_name Invalid cursor name
Class 38 — External routine exception
38000 external_routine_exception External routine exception
38001 containing_sql_not_permitted Prohibited SQL statements contained
38002 modifying_sql_data_not_permitted SQL data cannot be modified
38003 prohibited_sql_statement_attempted Prohibited SQL statements attempted
38004 reading_sql_data_not_permitted SQL data cannot be read
Class 39 — External routine invocation exception
39000 external_routine_invocation_exception Exception during external routine invocation
39001 invalid_sqlstate_returned Returned SQL statement invalid
39004 null_value_not_allowed NULL values not allowed
39P01 trigger_protocol_violated Trigger protocol violated
39P02 srf_protocol_violated SRF protocol violated
Class 3B — Savepoint exception
3B000 savepoint_exception Savepoint exception
3B001 invalid_savepoint_specification Invalid savepoint specification
Class 3D — Invalid catalog name
3D000 invalid_catalog_name Invalid database name
Class 3F — Invalid schema name
3F000 invalid_schema_name Invalid schema name
Class 40 — Transaction rollback
40000 transaction_rollback Transaction rolled back
40002 transaction_integrity_constraint_violation Transaction integrity constraint violated
40001 serialization_failure Serialization failure
40003 statement_completion_unknown Statement completion unknown
40P01 deadlock_detected Deadlock detected
Class 42 — Syntax error or access rule violation
42000 syntax_error_or_access_rule_violation Syntax error or access rule violation
42601 syntax_error Syntax error
42501 insufficient_privilege Required permissions not granted
42846 cannot_coerce Data type cannot be converted
42803 grouping_error Grouping error
42830 invalid_foreign_key Invalid foreign key
42602 invalid_name Invalid name
42622 name_too_long Name exceeds length limit
42939 reserved_name Reserved name
42804 datatype_mismatch Data types do not match
42P18 indeterminate_datatype Indeterminate data type
42809 wrong_object_type Invalid object type
42703 undefined_column Undefined column
42883 undefined_function Undefined function
42P01 undefined_table Undefined table
42P02 undefined_parameter Undefined parameter
42704 undefined_object Undefined object
42701 duplicate_column Duplicate column
42P03 duplicate_cursor Duplicate cursor
42P04 duplicate_database Duplicate database
42723 duplicate_function Duplicate function
42P05 duplicate_prepared_statement Duplicate prepared statement
42P06 duplicate_schema Duplicate schema
42P07 duplicate_table Duplicate table
42712 duplicate_alias Duplicate alias
42710 duplicate_object Duplicate object
42702 ambiguous_column Ambiguous column
42725 ambiguous_function Ambiguous function
42P08 ambiguous_parameter Ambiguous parameter
42P09 ambiguous_alias Ambiguous alias
42P10 invalid_column_reference Invalid column reference
42611 invalid_column_definition Invalid column definition
42P11 invalid_cursor_definition Invalid cursor definition
42P12 invalid_database_definition Invalid database definition
42P13 invalid_function_definition Invalid function definition
42P14 invalid_prepared_statement_definition Invalid prepared statement definition
42P15 invalid_schema_definition Invalid schema definition
42P16 invalid_table_definition Invalid table definition
42P17 invalid_object_definition Invalid object definition
Class 44 — WITH CHECK OPTION violation
44000 with_check_option_violation WITH CHECK OPTION violated
Class 53 — Insufficient resources
53000 insufficient_resources Insufficient resources
53100 disk_full Disk full
53200 out_of_memory Memory exhausted
53300 too_many_connections Number of connections exceeds limit
Class 54 — Program limit exceeded
54000 program_limit_exceeded Program limit exceeded
54001 statement_too_complex Statement too complex
54011 too_many_columns Number of columns exceeds limit
54023 too_many_arguments Number of arguments exceeds limit
Class 55 — Object not in prerequisite state
55000 object_not_in_prerequisite_state Object not in required state
55006 object_in_use Object in use
55P02 cant_change_runtime_param Runtime parameters cannot be modified
55P03 lock_not_available Lock unavailable
Class 57 — Operator intervention
57000 operator_intervention Operator intervention
57014 query_canceled Query canceled
57P01 admin_shutdown System shut down by administrator
57P02 crash_shutdown System shut down due to crash
57P03 cannot_connect_now Cannot connect now
Class 58 — System error
58030 io_error I/O error
58P01 undefined_file Undefined file
58P02 duplicate_file Duplicate file
Class F0 — Configuration file error
F0000 config_file_error Configuration file error
F0001 lock_file_exists Lock file exists
Class P0 — PL/pgSQL error
P0000 plpgsql_error PL/pgSQL error
P0001 raise_exception Exception raised
Class XX — Internal error
XX000 internal_error Internal error
XX001 data_corrupted Data corrupted
XX002 index_corrupted Index corrupted