Skip to content

PostgreSQL SQLSTATE Atlas

Find a PostgreSQL SQLSTATE, understand the failure stage, and find diagnosis and recovery guidance.

Start with the five-character code from a driver exception or server log. The catalogue keeps the SQLSTATE uppercase as its stable identity; URLs use lowercase where a letter is present. Search covers condition names, macros, translated names, and verified message templates.

Browse the atlas

Entry point Use it for
All codes The complete deduplicated SQLSTATE directory
Classes Shared meaning and members of a class
Common codes A curated incident-oriented starting list
Topics Constraint, authentication, transaction, timeout, and resource paths
Versions Presence and evidence-backed changes by PostgreSQL release
Guides Reading diagnostics, transaction recovery, retry, and client handling

Evidence contract

Each accepted entry separates directory identity, implementation paths, documented behavior, and local runtime observations. A source-only fact is labelled as such; a runtime claim names its case and run result. Preview releases are kept in their own version view and do not inflate the formal release count.

The directory contains all 263 frozen SQLSTATE identities as paired English and Chinese pages. Coverage reports distinguish full explanations, source-backed references, editorial review, and selected runtime outcomes; a source-backed reference does not claim a runtime diagnosis without a retained case result.

Coverage

See coverage for the version matrix and methodology for collection boundaries, evidence states, and translation rules.

All SQLSTATE codes

The complete SQLSTATE directory, generated from frozen PostgreSQL release sources.

SQLSTATE classes

Browse PostgreSQL conditions by the first two characters of SQLSTATE.

Common codes

A curated list of SQLSTATE values useful during incident triage.

Topics

Start from an operational problem and find its SQLSTATE paths.

PostgreSQL versions

Compare SQLSTATE definitions and documented changes across releases.

Guides

Shared methods for reading PostgreSQL diagnostics, recovering transaction state, and choosing client boundaries.

Coverage

Version, language, content-depth, and evidence coverage for the atlas.

Methodology

Scope, source locking, evidence states, and translation maintenance for the SQLSTATE atlas.

00000 — successful_completion

PostgreSQL SQLSTATE 00000 represents successful completion and is not a normal error condition.

01000 — warning

PostgreSQL uses SQLSTATE 01000 for the generic warning condition. Separate directory classification from the actual WARNING or NOTICE severity, then diagnose the emitting subsystem.

01003 — null_value_eliminated_in_set_function

PostgreSQL SQLSTATE 01003 names a warning for null values eliminated by a set function; the fixed core scan provides no emitting path.

01004 — string_data_right_truncation

PostgreSQL SQLSTATE 01004 names a warning-category string truncation condition; the fixed core scan provides no emitting path.

01006 — privilege_not_revoked

PostgreSQL SQLSTATE 01006 is emitted as a WARNING when a REVOKE operation removes none or not all of the requested privileges.

01007 — privilege_not_granted

PostgreSQL SQLSTATE 01007 is emitted as a WARNING when a GRANT operation grants none or not all of the requested privileges.

01008 — implicit_zero_bit_padding

PostgreSQL SQLSTATE 01008 names a warning for implicit zero-bit padding; the fixed core scan provides no emitting path.

0100C — dynamic_result_sets_returned

PostgreSQL SQLSTATE 0100C names a warning for dynamic result sets returned; the fixed core scan provides no emitting path.

01P01 — deprecated_feature

PostgreSQL SQLSTATE 01P01 is a WARNING used to announce a deprecated feature; PostgreSQL 18.6 has a fixed MD5-password path.

02000 — no_data

PostgreSQL SQLSTATE 02000 is a no-data condition; PostgreSQL 18.6 has DEBUG diagnostics in amcheck, not a rule that every zero-row SELECT raises it.

02001 — no_additional_dynamic_result_sets_returned

PostgreSQL SQLSTATE 02001 names a no-additional-dynamic-result-sets condition; the fixed core scan provides no emitting path.

03000 — sql_statement_not_yet_complete

PostgreSQL SQLSTATE 03000 names an incomplete SQL-statement condition; the fixed core scan provides no resolved emitter.

08000 — connection_exception

PostgreSQL SQLSTATE 08000: connection_exception, source-backed diagnosis and recovery guidance.

08001 — sqlclient_unable_to_establish_sqlconnection

PostgreSQL SQLSTATE 08001: sqlclient_unable_to_establish_sqlconnection, source-backed diagnosis and recovery guidance.

08003 — connection_does_not_exist

PostgreSQL SQLSTATE 08003: connection_does_not_exist, source-backed diagnosis and recovery guidance.

08004 — sqlserver_rejected_establishment_of_sqlconnection

PostgreSQL SQLSTATE 08004: sqlserver_rejected_establishment_of_sqlconnection, source-backed diagnosis and recovery guidance.

08006 — connection_failure

PostgreSQL SQLSTATE 08006: connection_failure, source-backed diagnosis and recovery guidance.

08007 — transaction_resolution_unknown

PostgreSQL SQLSTATE 08007: transaction_resolution_unknown, source-backed diagnosis and recovery guidance.

08P01 — protocol_violation

PostgreSQL SQLSTATE 08P01: protocol_violation, source-backed diagnosis and recovery guidance.

09000 — triggered_action_exception

Source-backed reference for PostgreSQL SQLSTATE 09000.

0A000 — feature_not_supported

PostgreSQL SQLSTATE 0A000: feature_not_supported, source-backed diagnosis and recovery guidance.

0B000 — invalid_transaction_initiation

Source-bounded reference for PostgreSQL SQLSTATE 0B000.

0F000 — locator_exception

Source-bounded reference for PostgreSQL SQLSTATE 0F000.

0F001 — invalid_locator_specification

Source-bounded reference for PostgreSQL SQLSTATE 0F001.

0L000 — invalid_grantor

PostgreSQL SQLSTATE 0L000: invalid_grantor, source-backed diagnosis and recovery guidance.

0LP01 — invalid_grant_operation

PostgreSQL SQLSTATE 0LP01: invalid_grant_operation, source-backed diagnosis and recovery guidance.

0P000 — invalid_role_specification

PostgreSQL SQLSTATE 0P000: invalid_role_specification, source-backed diagnosis and recovery guidance.

0Z000 — diagnostics_exception

Source-bounded reference for PostgreSQL SQLSTATE 0Z000.

0Z002 — stacked_diagnostics_accessed_without_active_handler

Source-backed reference for PostgreSQL SQLSTATE 0Z002.

10608 — invalid_argument_for_xquery

Source-backed reference for PostgreSQL SQLSTATE 10608.

20000 — case_not_found

Source-backed reference for PostgreSQL SQLSTATE 20000.

21000 — cardinality_violation

PostgreSQL SQLSTATE 21000: cardinality_violation, with source-backed scalar-subquery and command-level diagnostics.

22000 — data_exception

Source-backed reference for PostgreSQL SQLSTATE 22000.

22001 — string_data_right_truncation

Source-backed reference for PostgreSQL SQLSTATE 22001.

22002 — null_value_no_indicator_parameter

Source-backed reference for PostgreSQL SQLSTATE 22002.

22003 — numeric_value_out_of_range

Source-backed reference for PostgreSQL SQLSTATE 22003.

22004 — null_value_not_allowed

Source-backed reference for PostgreSQL SQLSTATE 22004.

22005 — error_in_assignment

Source-backed reference for PostgreSQL SQLSTATE 22005.

22007 — invalid_datetime_format

Source-backed reference for PostgreSQL SQLSTATE 22007.

22008 — datetime_field_overflow

Source-backed reference for PostgreSQL SQLSTATE 22008.

22009 — invalid_time_zone_displacement_value

Source-backed reference for PostgreSQL SQLSTATE 22009.

2200B — escape_character_conflict

Source-backed reference for PostgreSQL SQLSTATE 2200B.

2200C — invalid_use_of_escape_character

Source-backed reference for PostgreSQL SQLSTATE 2200C.

2200D — invalid_escape_octet

Source-backed reference for PostgreSQL SQLSTATE 2200D.

2200F — zero_length_character_string

Source-backed reference for PostgreSQL SQLSTATE 2200F.

2200G — most_specific_type_mismatch

Source-backed reference for PostgreSQL SQLSTATE 2200G.

2200H — sequence_generator_limit_exceeded

Source-backed reference for PostgreSQL SQLSTATE 2200H.

2200L — not_an_xml_document

Source-backed reference for PostgreSQL SQLSTATE 2200L.

2200M — invalid_xml_document

Source-backed reference for PostgreSQL SQLSTATE 2200M.

2200N — invalid_xml_content

Source-backed reference for PostgreSQL SQLSTATE 2200N.

2200S — invalid_xml_comment

Source-backed reference for PostgreSQL SQLSTATE 2200S.

2200T — invalid_xml_processing_instruction

Source-backed reference for PostgreSQL SQLSTATE 2200T.

22010 — invalid_indicator_parameter_value

Source-backed reference for PostgreSQL SQLSTATE 22010.

22011 — substring_error

Source-backed reference for PostgreSQL SQLSTATE 22011.

22012 — division_by_zero

Source-backed reference for PostgreSQL SQLSTATE 22012.

22013 — invalid_preceding_or_following_size

Source-backed reference for PostgreSQL SQLSTATE 22013.

22014 — invalid_argument_for_ntile_function

Source-backed reference for PostgreSQL SQLSTATE 22014.

22015 — interval_field_overflow

Source-backed reference for PostgreSQL SQLSTATE 22015.

22016 — invalid_argument_for_nth_value_function

Source-backed reference for PostgreSQL SQLSTATE 22016.

22018 — invalid_character_value_for_cast

Source-backed reference for PostgreSQL SQLSTATE 22018.

22019 — invalid_escape_character

Source-backed reference for PostgreSQL SQLSTATE 22019.

2201B — invalid_regular_expression

Source-backed reference for PostgreSQL SQLSTATE 2201B.

2201E — invalid_argument_for_logarithm

Source-backed reference for PostgreSQL SQLSTATE 2201E.

2201F — invalid_argument_for_power_function

Source-backed reference for PostgreSQL SQLSTATE 2201F.

2201G — invalid_argument_for_width_bucket_function

Source-backed reference for PostgreSQL SQLSTATE 2201G.

2201W — invalid_row_count_in_limit_clause

Source-backed reference for PostgreSQL SQLSTATE 2201W.

2201X — invalid_row_count_in_result_offset_clause

Source-backed reference for PostgreSQL SQLSTATE 2201X.

22021 — character_not_in_repertoire

Source-backed reference for PostgreSQL SQLSTATE 22021.

22022 — indicator_overflow

Source-backed reference for PostgreSQL SQLSTATE 22022.

22023 — invalid_parameter_value

Source-backed reference for PostgreSQL SQLSTATE 22023.

22024 — unterminated_c_string

Source-backed reference for PostgreSQL SQLSTATE 22024.

22025 — invalid_escape_sequence

Source-backed reference for PostgreSQL SQLSTATE 22025.

22026 — string_data_length_mismatch

Source-backed reference for PostgreSQL SQLSTATE 22026.

22027 — trim_error

Source-backed reference for PostgreSQL SQLSTATE 22027.

2202E — array_subscript_error

PostgreSQL uses SQLSTATE 2202E for array subscript and shape errors. Separate an out-of-bounds read that returns NULL from assignment, slice, constructor, and concatenation paths that validate array dimensions.

2202G — invalid_tablesample_repeat

Source-backed reference for PostgreSQL SQLSTATE 2202G.

2202H — invalid_tablesample_argument

Source-backed reference for PostgreSQL SQLSTATE 2202H.

22030 — duplicate_json_object_key_value

Source-backed reference for PostgreSQL SQLSTATE 22030.

22031 — invalid_argument_for_sql_json_datetime_function

Source-backed reference for PostgreSQL SQLSTATE 22031.

22032 — invalid_json_text

Source-backed reference for PostgreSQL SQLSTATE 22032.

22033 — invalid_sql_json_subscript

Source-backed reference for PostgreSQL SQLSTATE 22033.

22034 — more_than_one_sql_json_item

Source-backed reference for PostgreSQL SQLSTATE 22034.

22035 — no_sql_json_item

Source-backed reference for PostgreSQL SQLSTATE 22035.

22036 — non_numeric_sql_json_item

Source-backed reference for PostgreSQL SQLSTATE 22036.

22037 — non_unique_keys_in_a_json_object

Source-backed reference for PostgreSQL SQLSTATE 22037.

22038 — singleton_sql_json_item_required

Source-backed reference for PostgreSQL SQLSTATE 22038.

22039 — sql_json_array_not_found

Source-backed reference for PostgreSQL SQLSTATE 22039.

2203A — sql_json_member_not_found

Source-backed reference for PostgreSQL SQLSTATE 2203A.

2203B — sql_json_number_not_found

Source-backed reference for PostgreSQL SQLSTATE 2203B.

2203C — sql_json_object_not_found

Source-backed reference for PostgreSQL SQLSTATE 2203C.

2203D — too_many_json_array_elements

Source-backed reference for PostgreSQL SQLSTATE 2203D.

2203E — too_many_json_object_members

Source-backed reference for PostgreSQL SQLSTATE 2203E.

2203F — sql_json_scalar_required

Source-backed reference for PostgreSQL SQLSTATE 2203F.

2203G — sql_json_item_cannot_be_cast_to_target_type

Source-backed reference for PostgreSQL SQLSTATE 2203G.

22P01 — floating_point_exception

Source-backed reference for PostgreSQL SQLSTATE 22P01.

22P02 — Invalid text representation

PostgreSQL SQLSTATE 22P02: Invalid text representation (invalid_text_representation), source-backed diagnosis and recovery guidance.

22P03 — invalid_binary_representation

Source-backed reference for PostgreSQL SQLSTATE 22P03.

22P04 — bad_copy_file_format

Source-backed reference for PostgreSQL SQLSTATE 22P04.

22P05 — untranslatable_character

Source-backed reference for PostgreSQL SQLSTATE 22P05.

22P06 — nonstandard_use_of_escape_character

Source-backed reference for PostgreSQL SQLSTATE 22P06.

23000 — integrity_constraint_violation

PostgreSQL SQLSTATE 23000: the Class 23 integrity_constraint_violation umbrella and its concrete descendants.

23001 — restrict_violation

PostgreSQL SQLSTATE 23001: restrict_violation from an immediate foreign-key RESTRICT action.

23502 — not_null_violation

PostgreSQL SQLSTATE 23502: not_null_violation with column-aware diagnosis and repair boundaries.

23503 — foreign_key_violation

PostgreSQL reports SQLSTATE 23503 for a child foreign-key violation and some ordinary parent actions. Identify the action, relation, and constraint, then repair the data or transaction boundary.

23505 — unique_violation

PostgreSQL reports 23505 when a row or index operation violates a unique invariant. Diagnose the named object, recover the transaction, and choose a business-safe repair.

23514 — check_violation

PostgreSQL SQLSTATE 23514: check_violation with CHECK and partition validation boundaries.

23P01 — exclusion_violation

PostgreSQL SQLSTATE 23P01: exclusion_violation for conflicting exclusion-constraint operators.

24000 — invalid_cursor_state

PostgreSQL SQLSTATE 24000: invalid_cursor_state for a cursor that is not positioned on a row.

25000 — invalid_transaction_state

PostgreSQL SQLSTATE 25000: the broad invalid_transaction_state condition and its internal parallel-operation boundary.

25001 — active_sql_transaction

PostgreSQL SQLSTATE 25001: active_sql_transaction and the explicit transaction boundary required by utility commands.

25002 — branch_transaction_already_active

PostgreSQL SQLSTATE 25002: the narrow branch_transaction_already_active definition.

25003 — inappropriate_access_mode_for_branch_transaction

PostgreSQL SQLSTATE 25003: the branch-transaction access-mode condition, with a conservative source boundary.

25004 — inappropriate_isolation_level_for_branch_transaction

PostgreSQL SQLSTATE 25004: the branch-transaction isolation-level condition, with a fixed source boundary.

25005 — no_active_sql_transaction_for_branch_transaction

PostgreSQL SQLSTATE 25005: the branch-transaction no-active-transaction condition and its source-only boundary.

25006 — read_only_sql_transaction

PostgreSQL SQLSTATE 25006: read-only transaction failures, diagnostics, and the transaction boundary needed for repair.

25007 — schema_and_data_statement_mixing_not_supported

PostgreSQL SQLSTATE 25007: the schema/data statement mixing condition and its conservative source boundary.

25008 — held_cursor_requires_same_isolation_level

PostgreSQL SQLSTATE 25008: the held-cursor isolation-level condition and its source-only boundary.

25P01 — no_active_sql_transaction

PostgreSQL SQLSTATE 25P01: operations such as SAVEPOINT require an explicit transaction block.

25P02 — in_failed_sql_transaction

PostgreSQL SQLSTATE 25P02: the secondary transaction state after an earlier statement error.

25P03 — idle_in_transaction_session_timeout

PostgreSQL SQLSTATE 25P03: diagnosing and recovering from server termination of a session idle inside an open transaction.

25P04 — transaction_timeout

PostgreSQL SQLSTATE 25P04: session termination when an explicit or implicit transaction exceeds transaction_timeout.

26000 — invalid_sql_statement_name

PostgreSQL SQLSTATE 26000: named prepared statement lookup, session affinity, and recovery.

27000 — triggered_data_change_violation

Source-backed reference for PostgreSQL SQLSTATE 27000, with explicit mechanism boundaries.

28000 — invalid_authorization_specification

PostgreSQL SQLSTATE 28000: invalid_authorization_specification, source-backed diagnosis and recovery guidance.

28P01 — invalid_password

PostgreSQL reports SQLSTATE 28P01 when password authentication fails during connection startup. Check the matched pg_hba.conf rule and role secret, then prove recovery with a fresh connection.

2B000 — dependent_privilege_descriptors_still_exist

Source-backed reference for PostgreSQL SQLSTATE 2B000, with explicit mechanism boundaries.

2BP01 — dependent_objects_still_exist

PostgreSQL SQLSTATE 2BP01: dependency-aware DROP diagnostics and repair.

2D000 — invalid_transaction_termination

Source-backed reference for PostgreSQL SQLSTATE 2D000, with explicit mechanism boundaries.

2F000 — sql_routine_exception

Source-bounded reference for PostgreSQL SQLSTATE 2F000.

2F002 — modifying_sql_data_not_permitted

Source-bounded reference for PostgreSQL SQLSTATE 2F002.

2F003 — prohibited_sql_statement_attempted

Source-backed reference for PostgreSQL SQLSTATE 2F003.

2F004 — reading_sql_data_not_permitted

Source-backed reference for PostgreSQL SQLSTATE 2F004.

2F005 — function_executed_no_return_statement

Source-backed reference for PostgreSQL SQLSTATE 2F005.

34000 — invalid_cursor_name

PostgreSQL SQLSTATE 34000: cursor lifecycle, session affinity, and recovery.

38000 — external_routine_exception

Source-backed reference for PostgreSQL SQLSTATE 38000.

38001 — containing_sql_not_permitted

Source-backed reference for PostgreSQL SQLSTATE 38001.

38002 — modifying_sql_data_not_permitted

Source-backed reference for PostgreSQL SQLSTATE 38002.

38003 — prohibited_sql_statement_attempted

Source-backed reference for PostgreSQL SQLSTATE 38003.

38004 — reading_sql_data_not_permitted

Source-backed reference for PostgreSQL SQLSTATE 38004.

39000 — external_routine_invocation_exception

Source-backed reference for PostgreSQL SQLSTATE 39000.

39001 — invalid_sqlstate_returned

Source-backed reference for PostgreSQL SQLSTATE 39001.

39004 — null_value_not_allowed

Source-backed reference for PostgreSQL SQLSTATE 39004.

39P01 — trigger_protocol_violated

Source-backed reference for PostgreSQL SQLSTATE 39P01.

39P02 — srf_protocol_violated

Source-backed reference for PostgreSQL SQLSTATE 39P02.

39P03 — event_trigger_protocol_violated

Source-backed reference for PostgreSQL SQLSTATE 39P03.

3B000 — savepoint_exception

Source-backed reference for PostgreSQL SQLSTATE 3B000, with explicit mechanism boundaries.

3B001 — invalid_savepoint_specification

PostgreSQL SQLSTATE 3B001: missing savepoints, transaction state, and recovery.

3D000 — invalid_catalog_name

PostgreSQL SQLSTATE 3D000: invalid_catalog_name, source-backed diagnosis and recovery guidance.

3F000 — invalid_schema_name

PostgreSQL SQLSTATE 3F000: invalid_schema_name, source-backed diagnosis and recovery guidance.

40000 — transaction_rollback

Source-backed reference for PostgreSQL SQLSTATE 40000, with explicit mechanism boundaries.

40001 — serialization_failure

PostgreSQL reports SQLSTATE 40001 when a serializable transaction cannot be committed consistently with a concurrent update. Roll back and retry the complete transaction from a fresh snapshot.

40002 — transaction_integrity_constraint_violation

Source-backed reference for PostgreSQL SQLSTATE 40002, with explicit mechanism boundaries.

40003 — statement_completion_unknown

Source-backed reference for PostgreSQL SQLSTATE 40003, with explicit mechanism boundaries.

40P01 — deadlock_detected

PostgreSQL reports SQLSTATE 40P01 when transactions form a lock cycle. Roll back the victim, keep lock order consistent, and retry the complete operation only when its business semantics permit it.

42000 — syntax_error_or_access_rule_violation

PostgreSQL SQLSTATE 42000: syntax_error_or_access_rule_violation, source-backed diagnosis and recovery guidance.

42501 — insufficient_privilege

PostgreSQL SQLSTATE 42501: insufficient_privilege, source-backed diagnosis and recovery guidance.

42601 — syntax_error

PostgreSQL SQLSTATE 42601: syntax_error, source-backed diagnosis and recovery guidance.

42602 — invalid_name

PostgreSQL SQLSTATE 42602: invalid_name, source-backed diagnosis and recovery guidance.

42611 — invalid_column_definition

PostgreSQL SQLSTATE 42611: invalid_column_definition, source-backed diagnosis and recovery guidance.

42622 — name_too_long

PostgreSQL SQLSTATE 42622: name_too_long, source-backed diagnosis and recovery guidance.

42701 — duplicate_column

PostgreSQL SQLSTATE 42701: duplicate_column, source-backed diagnosis and recovery guidance.

42702 — ambiguous_column

PostgreSQL SQLSTATE 42702: ambiguous_column, source-backed diagnosis and recovery guidance.

42703 — undefined_column

PostgreSQL SQLSTATE 42703: undefined_column, source-backed diagnosis and recovery guidance.

42704 — undefined_object

PostgreSQL SQLSTATE 42704: undefined_object, source-backed diagnosis and recovery guidance.

42710 — Duplicate object

PostgreSQL SQLSTATE 42710: Duplicate object (duplicate_object), source-backed diagnosis and recovery guidance.

42712 — Duplicate alias

PostgreSQL SQLSTATE 42712: Duplicate alias (duplicate_alias), source-backed diagnosis and recovery guidance.

42723 — Duplicate function

PostgreSQL SQLSTATE 42723: Duplicate function (duplicate_function), source-backed diagnosis and recovery guidance.

42725 — Ambiguous function

PostgreSQL SQLSTATE 42725: Ambiguous function (ambiguous_function), source-backed diagnosis and recovery guidance.

42803 — Grouping error

PostgreSQL SQLSTATE 42803: Grouping error (grouping_error), source-backed diagnosis and recovery guidance.

42804 — Datatype mismatch

PostgreSQL SQLSTATE 42804: Datatype mismatch (datatype_mismatch), source-backed diagnosis and recovery guidance.

42809 — Wrong object type

PostgreSQL SQLSTATE 42809: Wrong object type (wrong_object_type), source-backed diagnosis and recovery guidance.

42830 — Invalid foreign key

PostgreSQL SQLSTATE 42830: Invalid foreign key (invalid_foreign_key), source-backed diagnosis and recovery guidance.

42846 — Cannot coerce

PostgreSQL SQLSTATE 42846: Cannot coerce (cannot_coerce), source-backed diagnosis and recovery guidance.

42883 — Undefined function

PostgreSQL SQLSTATE 42883: Undefined function (undefined_function), source-backed diagnosis and recovery guidance.

428C9 — Generated-always column assignment

PostgreSQL SQLSTATE 428C9: Generated-always column assignment (generated_always), source-backed diagnosis and recovery guidance.

42939 — Reserved name

PostgreSQL SQLSTATE 42939: Reserved name (reserved_name), source-backed diagnosis and recovery guidance.

42P01 — undefined_table

PostgreSQL reports SQLSTATE 42P01 when a referenced relation cannot be resolved. Check schema qualification, search_path, quoting, and migrations before creating or renaming objects.

42P02 — Undefined parameter

PostgreSQL SQLSTATE 42P02: Undefined parameter (undefined_parameter), source-backed diagnosis and recovery guidance.

42P03 — Duplicate cursor

PostgreSQL SQLSTATE 42P03: Duplicate cursor (duplicate_cursor), source-backed diagnosis and recovery guidance.

42P04 — Duplicate database

PostgreSQL SQLSTATE 42P04: Duplicate database (duplicate_database), source-backed diagnosis and recovery guidance.

42P05 — Duplicate prepared statement

PostgreSQL SQLSTATE 42P05: Duplicate prepared statement (duplicate_prepared_statement), source-backed diagnosis and recovery guidance.

42P06 — Duplicate schema

PostgreSQL SQLSTATE 42P06: Duplicate schema (duplicate_schema), source-backed diagnosis and recovery guidance.

42P07 — Duplicate table or relation definition

PostgreSQL SQLSTATE 42P07: Duplicate table or relation definition (duplicate_table), source-backed diagnosis and recovery guidance.

42P08 — Ambiguous parameter type

PostgreSQL SQLSTATE 42P08: Ambiguous parameter type (ambiguous_parameter), source-backed diagnosis and recovery guidance.

42P09 — Ambiguous table alias

PostgreSQL SQLSTATE 42P09: Ambiguous table alias (ambiguous_alias), source-backed diagnosis and recovery guidance.

42P10 — Invalid column reference

Source-backed reference for PostgreSQL SQLSTATE 42P10.

42P11 — Invalid cursor definition

Source-backed reference for PostgreSQL SQLSTATE 42P11.

42P12 — Invalid database definition

Source-backed reference for PostgreSQL SQLSTATE 42P12.

42P13 — Invalid function definition

Source-backed reference for PostgreSQL SQLSTATE 42P13.

42P14 — Invalid prepared statement definition

Source-backed reference for PostgreSQL SQLSTATE 42P14.

42P15 — Invalid schema definition

Source-backed reference for PostgreSQL SQLSTATE 42P15.

42P16 — Invalid table definition

Source-backed reference for PostgreSQL SQLSTATE 42P16.

42P17 — Invalid object definition

Source-backed reference for PostgreSQL SQLSTATE 42P17.

42P18 — Indeterminate datatype

Source-backed reference for PostgreSQL SQLSTATE 42P18.

42P19 — Invalid recursion

Source-backed reference for PostgreSQL SQLSTATE 42P19.

42P20 — Windowing error

Source-backed reference for PostgreSQL SQLSTATE 42P20.

42P21 — Collation mismatch

Source-backed reference for PostgreSQL SQLSTATE 42P21.

42P22 — Indeterminate collation

Source-backed reference for PostgreSQL SQLSTATE 42P22.

44000 — with_check_option_violation

PostgreSQL SQLSTATE 44000: view WITH CHECK OPTION diagnostics and repair.

53000 — insufficient_resources

Source-backed reference for PostgreSQL SQLSTATE 53000.

53100 — disk_full

Source-backed reference for PostgreSQL SQLSTATE 53100.

53200 — out_of_memory

Source-backed reference for PostgreSQL SQLSTATE 53200.

53300 — too_many_connections

PostgreSQL reports SQLSTATE 53300 when a connection cannot be admitted because a connection limit is exhausted. Identify the role, database, or server limit and verify a fresh connection after capacity is restored.

53400 — configuration_limit_exceeded

Source-backed reference for PostgreSQL SQLSTATE 53400.

54000 — program_limit_exceeded

Source-backed reference for PostgreSQL SQLSTATE 54000.

54001 — statement_too_complex

Source-backed reference for PostgreSQL SQLSTATE 54001.

54011 — too_many_columns

Source-backed reference for PostgreSQL SQLSTATE 54011.

54023 — too_many_arguments

Source-backed reference for PostgreSQL SQLSTATE 54023.

55000 — Object not in prerequisite state

PostgreSQL SQLSTATE 55000: Object not in prerequisite state (object_not_in_prerequisite_state), source-backed diagnosis and recovery guidance.

55006 — Object in use

PostgreSQL SQLSTATE 55006: Object in use (object_in_use), source-backed diagnosis and recovery guidance.

55P02 — cant_change_runtime_param

Source-backed reference for PostgreSQL SQLSTATE 55P02.

55P03 — lock_not_available

Source-backed full entry for PostgreSQL SQLSTATE 55P03.

55P04 — unsafe_new_enum_value_usage

Source-backed reference for PostgreSQL SQLSTATE 55P04.

57000 — operator_intervention

Source-backed reference entry for PostgreSQL SQLSTATE 57000.

57014 — query_canceled

PostgreSQL reports SQLSTATE 57014 when a running statement is canceled, including by statement_timeout. Classify the cancel source, verify transaction state, and confirm that a follow-up operation is safe.

57P01 — admin_shutdown

Source-backed full entry for PostgreSQL SQLSTATE 57P01.

57P02 — crash_shutdown

Source-backed reference entry for PostgreSQL SQLSTATE 57P02.

57P03 — cannot_connect_now

Source-backed full entry for PostgreSQL SQLSTATE 57P03.

57P04 — database_dropped

Source-backed reference entry for PostgreSQL SQLSTATE 57P04.

57P05 — idle_session_timeout

Source-backed full entry for PostgreSQL SQLSTATE 57P05.

58000 — system_error

Source-backed reference entry for PostgreSQL SQLSTATE 58000.

58030 — io_error

Source-backed full reference for PostgreSQL SQLSTATE 58030.

58P01 — undefined_file

Source-backed full reference for PostgreSQL SQLSTATE 58P01.

58P02 — duplicate_file

Source-backed reference for PostgreSQL SQLSTATE 58P02.

58P03 — file_name_too_long

Source-backed full reference for PostgreSQL SQLSTATE 58P03.

72000 — snapshot_too_old

Source-backed historical reference for PostgreSQL SQLSTATE 72000.

Class 00 — Successful Completion

Members and evidence boundaries for PostgreSQL SQLSTATE class 00.

Class 01 — Warning

Members and evidence boundaries for PostgreSQL SQLSTATE class 01.

Class 02 — No Data (this is also a warning class per the SQL standard)

Members and evidence boundaries for PostgreSQL SQLSTATE class 02.

Class 03 — SQL Statement Not Yet Complete

Members and evidence boundaries for PostgreSQL SQLSTATE class 03.

Class 08 — Connection Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 08.

Class 09 — Triggered Action Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 09.

Class 0A — Feature Not Supported

Members and evidence boundaries for PostgreSQL SQLSTATE class 0A.

Class 0B — Invalid Transaction Initiation

Members and evidence boundaries for PostgreSQL SQLSTATE class 0B.

Class 0F — Locator Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 0F.

Class 0L — Invalid Grantor

Members and evidence boundaries for PostgreSQL SQLSTATE class 0L.

Class 0P — Invalid Role Specification

Members and evidence boundaries for PostgreSQL SQLSTATE class 0P.

Class 0Z — Diagnostics Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 0Z.

Class 10 — XQuery Error

Members and evidence boundaries for PostgreSQL SQLSTATE class 10.

Class 20 — Case Not Found

Members and evidence boundaries for PostgreSQL SQLSTATE class 20.

Class 21 — Cardinality Violation

Members and evidence boundaries for PostgreSQL SQLSTATE class 21.

Class 22 — Data Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 22.

Class 23 — Integrity Constraint Violation

Members and evidence boundaries for PostgreSQL SQLSTATE class 23.

Class 24 — Invalid Cursor State

Members and evidence boundaries for PostgreSQL SQLSTATE class 24.

Class 25 — Invalid Transaction State

Members and evidence boundaries for PostgreSQL SQLSTATE class 25.

Class 26 — Invalid SQL Statement Name

Members and evidence boundaries for PostgreSQL SQLSTATE class 26.

Class 27 — Triggered Data Change Violation

Members and evidence boundaries for PostgreSQL SQLSTATE class 27.

Class 28 — Invalid Authorization Specification

Members and evidence boundaries for PostgreSQL SQLSTATE class 28.

Class 2B — Dependent Privilege Descriptors Still Exist

Members and evidence boundaries for PostgreSQL SQLSTATE class 2B.

Class 2D — Invalid Transaction Termination

Members and evidence boundaries for PostgreSQL SQLSTATE class 2D.

Class 2F — SQL Routine Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 2F.

Class 34 — Invalid Cursor Name

Members and evidence boundaries for PostgreSQL SQLSTATE class 34.

Class 38 — External Routine Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 38.

Class 39 — External Routine Invocation Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 39.

Class 3B — Savepoint Exception

Members and evidence boundaries for PostgreSQL SQLSTATE class 3B.

Class 3D — Invalid Catalog Name

Members and evidence boundaries for PostgreSQL SQLSTATE class 3D.

Class 3F — Invalid Schema Name

Members and evidence boundaries for PostgreSQL SQLSTATE class 3F.

Class 40 — Transaction Rollback

Members and evidence boundaries for PostgreSQL SQLSTATE class 40.

Class 42 — Syntax Error or Access Rule Violation

Members and evidence boundaries for PostgreSQL SQLSTATE class 42.

Class 44 — WITH CHECK OPTION Violation

Members and evidence boundaries for PostgreSQL SQLSTATE class 44.

Class 53 — Insufficient Resources

Members and evidence boundaries for PostgreSQL SQLSTATE class 53.

Class 54 — Program Limit Exceeded

Members and evidence boundaries for PostgreSQL SQLSTATE class 54.

Class 55 — Object Not In Prerequisite State

Members and evidence boundaries for PostgreSQL SQLSTATE class 55.

Class 57 — Operator Intervention

Members and evidence boundaries for PostgreSQL SQLSTATE class 57.

Class 58 — System Error (errors external to PostgreSQL itself)

Members and evidence boundaries for PostgreSQL SQLSTATE class 58.

Class 72 — Snapshot Failure

Members and evidence boundaries for PostgreSQL SQLSTATE class 72.

Class F0 — Configuration File Error

Members and evidence boundaries for PostgreSQL SQLSTATE class F0.

Class HV — Foreign Data Wrapper Error (SQL/MED)

Members and evidence boundaries for PostgreSQL SQLSTATE class HV.

Class P0 — PL/pgSQL Error

Members and evidence boundaries for PostgreSQL SQLSTATE class P0.

Class XX — Internal Error

Members and evidence boundaries for PostgreSQL SQLSTATE class XX.

F0000 — config_file_error

Source-backed full reference for PostgreSQL SQLSTATE F0000.

F0001 — lock_file_exists

Source-backed full reference for PostgreSQL SQLSTATE F0001.

HV000 — fdw_error

PostgreSQL SQLSTATE HV000 is the SQL/MED foreign-data-wrapper error condition. Identify the wrapper callback and any remote diagnostic before deciding how to recover.

HV001 — fdw_out_of_memory

PostgreSQL SQLSTATE HV001 reports an FDW-side allocation failure. PostgreSQL’s bundled dblink and postgres_fdw paths use it while obtaining libpq connection options.

HV002 — fdw_dynamic_parameter_value_needed

PostgreSQL SQLSTATE HV002 reports a required FDW parameter that is unavailable. file_fdw raises it when a foreign table has neither filename nor program.

HV004 — fdw_invalid_data_type

PostgreSQL SQLSTATE HV004 denotes a foreign-data-wrapper data type mismatch. Confirm the wrapper’s type mapping and the local foreign-table definition.

HV005 — fdw_column_name_not_found

PostgreSQL SQLSTATE HV005 denotes a foreign column name that the FDW cannot find. Check the wrapper’s remote descriptor and name mapping.

HV006 — fdw_invalid_data_type_descriptors

PostgreSQL SQLSTATE HV006 denotes inconsistent or unusable FDW data-type descriptors. Inspect the wrapper metadata contract before changing SQL.

HV007 — fdw_invalid_column_name

PostgreSQL SQLSTATE HV007 denotes an invalid column name passed through an FDW descriptor or callback. Check wrapper naming rules and quoting.

HV008 — fdw_invalid_column_number

PostgreSQL SQLSTATE HV008 denotes an invalid foreign-column ordinal. Inspect the wrapper descriptor and local-to-remote column mapping.

HV009 — fdw_invalid_use_of_null_pointer

PostgreSQL SQLSTATE HV009 denotes an FDW null-pointer contract violation. Identify the wrapper callback and preserve the failure context.

HV00A — fdw_invalid_string_format

PostgreSQL SQLSTATE HV00A denotes a string format that an FDW cannot accept. Confirm the wrapper’s format grammar and the operation phase.

HV00B — fdw_invalid_handle

PostgreSQL SQLSTATE HV00B identifies an invalid handle at an FDW or SQL/MED boundary. The actual handle owner and lifecycle must come from the installed wrapper.

HV00C — fdw_invalid_option_index

PostgreSQL SQLSTATE HV00C identifies an invalid FDW option index. Confirm the wrapper’s option array and index contract before changing server options.

HV00D — fdw_invalid_option_name

PostgreSQL SQLSTATE HV00D reports an option name that the FDW implementation does not accept. file_fdw and postgres_fdw provide concrete validation messages and hints.

HV00J — fdw_option_name_not_found

PostgreSQL SQLSTATE HV00J is dblink’s option-name-not-found condition. It is separate from FDW option validation in postgres_fdw and file_fdw.

HV00K — fdw_reply_handle

PostgreSQL SQLSTATE HV00K identifies an FDW reply-handle condition. The reply lifecycle and operation phase must be read from the installed wrapper.

HV00L — fdw_unable_to_create_execution

PostgreSQL SQLSTATE HV00L identifies an FDW failure to create an execution object. Inspect the wrapper’s remote execution setup and resource contract.

HV00M — fdw_unable_to_create_reply

PostgreSQL SQLSTATE HV00M identifies an FDW failure to create a reply object. Diagnose the wrapper’s result-channel setup separately from execution creation.

HV00N — fdw_unable_to_establish_connection

PostgreSQL SQLSTATE HV00N identifies an FDW connection-establishment failure. The actual connection layer and diagnostic must come from the wrapper.

HV00P — fdw_no_schemas

PostgreSQL SQLSTATE HV00P reports that an FDW does not support IMPORT FOREIGN SCHEMA. The core command checks the wrapper callback directly.

HV00Q — fdw_schema_not_found

PostgreSQL SQLSTATE HV00Q reports that postgres_fdw cannot find the requested remote schema during IMPORT FOREIGN SCHEMA.

HV00R — fdw_table_not_found

PostgreSQL SQLSTATE HV00R names a table-not-found condition at an FDW boundary; the installed wrapper determines which table lookup and diagnostic are involved.

HV010 — fdw_function_sequence_error

PostgreSQL SQLSTATE HV010 names an FDW function-sequence condition; the wrapper and callback phase must be identified from the actual implementation.

HV014 — fdw_too_many_handles

PostgreSQL SQLSTATE HV014 names an FDW handle-limit condition; the resource owner and limit come from the installed wrapper.

HV021 — fdw_inconsistent_descriptor_information

PostgreSQL SQLSTATE HV021 names an FDW descriptor-consistency condition; the descriptor and producer must be identified from the wrapper implementation.

HV024 — fdw_invalid_attribute_value

PostgreSQL SQLSTATE HV024 names an invalid FDW attribute value; the relevant attribute and validator are implementation-specific.

HV090 — fdw_invalid_string_length_or_buffer_length

PostgreSQL SQLSTATE HV090 names an FDW string or buffer length condition; the buffer owner and valid bounds come from the actual wrapper or driver.

HV091 — fdw_invalid_descriptor_field_identifier

PostgreSQL SQLSTATE HV091 names an invalid FDW descriptor field identifier; the descriptor API and field namespace must come from the implementation.

P0000 — plpgsql_error

Source-backed reference for PostgreSQL SQLSTATE P0000.

P0001 — raise_exception

PostgreSQL uses SQLSTATE P0001 for a PL/pgSQL RAISE EXCEPTION with no explicit condition or SQLSTATE. Diagnose the application control flow and recover at the correct transaction boundary.

P0002 — no_data_found

Source-backed reference for PostgreSQL SQLSTATE P0002.

P0003 — too_many_rows

Source-backed reference for PostgreSQL SQLSTATE P0003.

P0004 — assert_failure

Source-backed reference for PostgreSQL SQLSTATE P0004.

PostgreSQL 10.23 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 10.23.

PostgreSQL 11.22 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 11.22.

PostgreSQL 12.22 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 12.22.

PostgreSQL 13.23 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 13.23.

PostgreSQL 14.24 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 14.24.

PostgreSQL 15.19 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 15.19.

PostgreSQL 16.15 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 16.15.

PostgreSQL 17.11 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 17.11.

PostgreSQL 18.6 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 18.6.

PostgreSQL 19beta3 — preview

SQLSTATE definition snapshot and evidence members for PostgreSQL 19beta3.

PostgreSQL 9.0.23 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 9.0.23.

PostgreSQL 9.1.24 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 9.1.24.

PostgreSQL 9.2.24 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 9.2.24.

PostgreSQL 9.3.25 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 9.3.25.

PostgreSQL 9.4.26 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 9.4.26.

PostgreSQL 9.5.25 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 9.5.25.

PostgreSQL 9.6.24 — formal

SQLSTATE definition snapshot and evidence members for PostgreSQL 9.6.24.

XX000 — internal_error

PostgreSQL uses SQLSTATE XX000 for internal-error paths and as the default code for an ERROR without an explicit code. Preserve the full diagnostic and investigate the exact subsystem; XX000 alone does not prove corruption.

XX001 — data_corrupted

Source-backed full reference for PostgreSQL SQLSTATE XX001.

XX002 — index_corrupted

Source-backed full reference for PostgreSQL SQLSTATE XX002.