]> begriffs open source - ai-pg/blob - full-docs/txt/errcodes-appendix.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / errcodes-appendix.txt
1
2 Appendix A. PostgreSQL Error Codes
3
4    All messages emitted by the PostgreSQL server are assigned
5    five-character error codes that follow the SQL standard's conventions
6    for “SQLSTATE” codes. Applications that need to know which error
7    condition has occurred should usually test the error code, rather than
8    looking at the textual error message. The error codes are less likely
9    to change across PostgreSQL releases, and also are not subject to
10    change due to localization of error messages. Note that some, but not
11    all, of the error codes produced by PostgreSQL are defined by the SQL
12    standard; some additional error codes for conditions not defined by the
13    standard have been invented or borrowed from other databases.
14
15    According to the standard, the first two characters of an error code
16    denote a class of errors, while the last three characters indicate a
17    specific condition within that class. Thus, an application that does
18    not recognize the specific error code might still be able to infer what
19    to do from the error class.
20
21    Table A.1 lists all the error codes defined in PostgreSQL 18.0. (Some
22    are not actually used at present, but are defined by the SQL standard.)
23    The error classes are also shown. For each error class there is a
24    “standard” error code having the last three characters 000. This code
25    is used only for error conditions that fall within the class but do not
26    have any more-specific code assigned.
27
28    The symbol shown in the column “Condition Name” is the condition name
29    to use in PL/pgSQL. Condition names can be written in either upper or
30    lower case. (Note that PL/pgSQL does not recognize warning, as opposed
31    to error, condition names; those are classes 00, 01, and 02.)
32
33    For some types of errors, the server reports the name of a database
34    object (a table, table column, data type, or constraint) associated
35    with the error; for example, the name of the unique constraint that
36    caused a unique_violation error. Such names are supplied in separate
37    fields of the error report message so that applications need not try to
38    extract them from the possibly-localized human-readable text of the
39    message. As of PostgreSQL 9.3, complete coverage for this feature
40    exists only for errors in SQLSTATE class 23 (integrity constraint
41    violation), but this is likely to be expanded in future.
42
43    Table A.1. PostgreSQL Error Codes
44    Error Code                       Condition Name
45    Class 00 — Successful Completion
46    00000      successful_completion
47    Class 01 — Warning
48    01000      warning
49    0100C      dynamic_result_sets_returned
50    01008      implicit_zero_bit_padding
51    01003      null_value_eliminated_in_set_function
52    01007      privilege_not_granted
53    01006      privilege_not_revoked
54    01004      string_data_right_truncation
55    01P01      deprecated_feature
56    Class 02 — No Data (this is also a warning class per the SQL standard)
57    02000      no_data
58    02001      no_additional_dynamic_result_sets_returned
59    Class 03 — SQL Statement Not Yet Complete
60    03000      sql_statement_not_yet_complete
61    Class 08 — Connection Exception
62    08000      connection_exception
63    08003      connection_does_not_exist
64    08006      connection_failure
65    08001      sqlclient_unable_to_establish_sqlconnection
66    08004      sqlserver_rejected_establishment_of_sqlconnection
67    08007      transaction_resolution_unknown
68    08P01      protocol_violation
69    Class 09 — Triggered Action Exception
70    09000      triggered_action_exception
71    Class 0A — Feature Not Supported
72    0A000      feature_not_supported
73    Class 0B — Invalid Transaction Initiation
74    0B000      invalid_transaction_initiation
75    Class 0F — Locator Exception
76    0F000      locator_exception
77    0F001      invalid_locator_specification
78    Class 0L — Invalid Grantor
79    0L000      invalid_grantor
80    0LP01      invalid_grant_operation
81    Class 0P — Invalid Role Specification
82    0P000      invalid_role_specification
83    Class 0Z — Diagnostics Exception
84    0Z000      diagnostics_exception
85    0Z002      stacked_diagnostics_accessed_without_active_handler
86    Class 10 — XQuery Error
87    10608      invalid_argument_for_xquery
88    Class 20 — Case Not Found
89    20000      case_not_found
90    Class 21 — Cardinality Violation
91    21000      cardinality_violation
92    Class 22 — Data Exception
93    22000      data_exception
94    2202E      array_subscript_error
95    22021      character_not_in_repertoire
96    22008      datetime_field_overflow
97    22012      division_by_zero
98    22005      error_in_assignment
99    2200B      escape_character_conflict
100    22022      indicator_overflow
101    22015      interval_field_overflow
102    2201E      invalid_argument_for_logarithm
103    22014      invalid_argument_for_ntile_function
104    22016      invalid_argument_for_nth_value_function
105    2201F      invalid_argument_for_power_function
106    2201G      invalid_argument_for_width_bucket_function
107    22018      invalid_character_value_for_cast
108    22007      invalid_datetime_format
109    22019      invalid_escape_character
110    2200D      invalid_escape_octet
111    22025      invalid_escape_sequence
112    22P06      nonstandard_use_of_escape_character
113    22010      invalid_indicator_parameter_value
114    22023      invalid_parameter_value
115    22013      invalid_preceding_or_following_size
116    2201B      invalid_regular_expression
117    2201W      invalid_row_count_in_limit_clause
118    2201X      invalid_row_count_in_result_offset_clause
119    2202H      invalid_tablesample_argument
120    2202G      invalid_tablesample_repeat
121    22009      invalid_time_zone_displacement_value
122    2200C      invalid_use_of_escape_character
123    2200G      most_specific_type_mismatch
124    22004      null_value_not_allowed
125    22002      null_value_no_indicator_parameter
126    22003      numeric_value_out_of_range
127    2200H      sequence_generator_limit_exceeded
128    22026      string_data_length_mismatch
129    22001      string_data_right_truncation
130    22011      substring_error
131    22027      trim_error
132    22024      unterminated_c_string
133    2200F      zero_length_character_string
134    22P01      floating_point_exception
135    22P02      invalid_text_representation
136    22P03      invalid_binary_representation
137    22P04      bad_copy_file_format
138    22P05      untranslatable_character
139    2200L      not_an_xml_document
140    2200M      invalid_xml_document
141    2200N      invalid_xml_content
142    2200S      invalid_xml_comment
143    2200T      invalid_xml_processing_instruction
144    22030      duplicate_json_object_key_value
145    22031      invalid_argument_for_sql_json_datetime_function
146    22032      invalid_json_text
147    22033      invalid_sql_json_subscript
148    22034      more_than_one_sql_json_item
149    22035      no_sql_json_item
150    22036      non_numeric_sql_json_item
151    22037      non_unique_keys_in_a_json_object
152    22038      singleton_sql_json_item_required
153    22039      sql_json_array_not_found
154    2203A      sql_json_member_not_found
155    2203B      sql_json_number_not_found
156    2203C      sql_json_object_not_found
157    2203D      too_many_json_array_elements
158    2203E      too_many_json_object_members
159    2203F      sql_json_scalar_required
160    2203G      sql_json_item_cannot_be_cast_to_target_type
161    Class 23 — Integrity Constraint Violation
162    23000      integrity_constraint_violation
163    23001      restrict_violation
164    23502      not_null_violation
165    23503      foreign_key_violation
166    23505      unique_violation
167    23514      check_violation
168    23P01      exclusion_violation
169    Class 24 — Invalid Cursor State
170    24000      invalid_cursor_state
171    Class 25 — Invalid Transaction State
172    25000      invalid_transaction_state
173    25001      active_sql_transaction
174    25002      branch_transaction_already_active
175    25008      held_cursor_requires_same_isolation_level
176    25003      inappropriate_access_mode_for_branch_transaction
177    25004      inappropriate_isolation_level_for_branch_transaction
178    25005      no_active_sql_transaction_for_branch_transaction
179    25006      read_only_sql_transaction
180    25007      schema_and_data_statement_mixing_not_supported
181    25P01      no_active_sql_transaction
182    25P02      in_failed_sql_transaction
183    25P03      idle_in_transaction_session_timeout
184    25P04      transaction_timeout
185    Class 26 — Invalid SQL Statement Name
186    26000      invalid_sql_statement_name
187    Class 27 — Triggered Data Change Violation
188    27000      triggered_data_change_violation
189    Class 28 — Invalid Authorization Specification
190    28000      invalid_authorization_specification
191    28P01      invalid_password
192    Class 2B — Dependent Privilege Descriptors Still Exist
193    2B000      dependent_privilege_descriptors_still_exist
194    2BP01      dependent_objects_still_exist
195    Class 2D — Invalid Transaction Termination
196    2D000      invalid_transaction_termination
197    Class 2F — SQL Routine Exception
198    2F000      sql_routine_exception
199    2F005      function_executed_no_return_statement
200    2F002      modifying_sql_data_not_permitted
201    2F003      prohibited_sql_statement_attempted
202    2F004      reading_sql_data_not_permitted
203    Class 34 — Invalid Cursor Name
204    34000      invalid_cursor_name
205    Class 38 — External Routine Exception
206    38000      external_routine_exception
207    38001      containing_sql_not_permitted
208    38002      modifying_sql_data_not_permitted
209    38003      prohibited_sql_statement_attempted
210    38004      reading_sql_data_not_permitted
211    Class 39 — External Routine Invocation Exception
212    39000      external_routine_invocation_exception
213    39001      invalid_sqlstate_returned
214    39004      null_value_not_allowed
215    39P01      trigger_protocol_violated
216    39P02      srf_protocol_violated
217    39P03      event_trigger_protocol_violated
218    Class 3B — Savepoint Exception
219    3B000      savepoint_exception
220    3B001      invalid_savepoint_specification
221    Class 3D — Invalid Catalog Name
222    3D000      invalid_catalog_name
223    Class 3F — Invalid Schema Name
224    3F000      invalid_schema_name
225    Class 40 — Transaction Rollback
226    40000      transaction_rollback
227    40002      transaction_integrity_constraint_violation
228    40001      serialization_failure
229    40003      statement_completion_unknown
230    40P01      deadlock_detected
231    Class 42 — Syntax Error or Access Rule Violation
232    42000      syntax_error_or_access_rule_violation
233    42601      syntax_error
234    42501      insufficient_privilege
235    42846      cannot_coerce
236    42803      grouping_error
237    42P20      windowing_error
238    42P19      invalid_recursion
239    42830      invalid_foreign_key
240    42602      invalid_name
241    42622      name_too_long
242    42939      reserved_name
243    42804      datatype_mismatch
244    42P18      indeterminate_datatype
245    42P21      collation_mismatch
246    42P22      indeterminate_collation
247    42809      wrong_object_type
248    428C9      generated_always
249    42703      undefined_column
250    42883      undefined_function
251    42P01      undefined_table
252    42P02      undefined_parameter
253    42704      undefined_object
254    42701      duplicate_column
255    42P03      duplicate_cursor
256    42P04      duplicate_database
257    42723      duplicate_function
258    42P05      duplicate_prepared_statement
259    42P06      duplicate_schema
260    42P07      duplicate_table
261    42712      duplicate_alias
262    42710      duplicate_object
263    42702      ambiguous_column
264    42725      ambiguous_function
265    42P08      ambiguous_parameter
266    42P09      ambiguous_alias
267    42P10      invalid_column_reference
268    42611      invalid_column_definition
269    42P11      invalid_cursor_definition
270    42P12      invalid_database_definition
271    42P13      invalid_function_definition
272    42P14      invalid_prepared_statement_definition
273    42P15      invalid_schema_definition
274    42P16      invalid_table_definition
275    42P17      invalid_object_definition
276    Class 44 — WITH CHECK OPTION Violation
277    44000      with_check_option_violation
278    Class 53 — Insufficient Resources
279    53000      insufficient_resources
280    53100      disk_full
281    53200      out_of_memory
282    53300      too_many_connections
283    53400      configuration_limit_exceeded
284    Class 54 — Program Limit Exceeded
285    54000      program_limit_exceeded
286    54001      statement_too_complex
287    54011      too_many_columns
288    54023      too_many_arguments
289    Class 55 — Object Not In Prerequisite State
290    55000      object_not_in_prerequisite_state
291    55006      object_in_use
292    55P02      cant_change_runtime_param
293    55P03      lock_not_available
294    55P04      unsafe_new_enum_value_usage
295    Class 57 — Operator Intervention
296    57000      operator_intervention
297    57014      query_canceled
298    57P01      admin_shutdown
299    57P02      crash_shutdown
300    57P03      cannot_connect_now
301    57P04      database_dropped
302    57P05      idle_session_timeout
303    Class 58 — System Error (errors external to PostgreSQL itself)
304    58000      system_error
305    58030      io_error
306    58P01      undefined_file
307    58P02      duplicate_file
308    58P03      file_name_too_long
309    Class F0 — Configuration File Error
310    F0000      config_file_error
311    F0001      lock_file_exists
312    Class HV — Foreign Data Wrapper Error (SQL/MED)
313    HV000      fdw_error
314    HV005      fdw_column_name_not_found
315    HV002      fdw_dynamic_parameter_value_needed
316    HV010      fdw_function_sequence_error
317    HV021      fdw_inconsistent_descriptor_information
318    HV024      fdw_invalid_attribute_value
319    HV007      fdw_invalid_column_name
320    HV008      fdw_invalid_column_number
321    HV004      fdw_invalid_data_type
322    HV006      fdw_invalid_data_type_descriptors
323    HV091      fdw_invalid_descriptor_field_identifier
324    HV00B      fdw_invalid_handle
325    HV00C      fdw_invalid_option_index
326    HV00D      fdw_invalid_option_name
327    HV090      fdw_invalid_string_length_or_buffer_length
328    HV00A      fdw_invalid_string_format
329    HV009      fdw_invalid_use_of_null_pointer
330    HV014      fdw_too_many_handles
331    HV001      fdw_out_of_memory
332    HV00P      fdw_no_schemas
333    HV00J      fdw_option_name_not_found
334    HV00K      fdw_reply_handle
335    HV00Q      fdw_schema_not_found
336    HV00R      fdw_table_not_found
337    HV00L      fdw_unable_to_create_execution
338    HV00M      fdw_unable_to_create_reply
339    HV00N      fdw_unable_to_establish_connection
340    Class P0 — PL/pgSQL Error
341    P0000      plpgsql_error
342    P0001      raise_exception
343    P0002      no_data_found
344    P0003      too_many_rows
345    P0004      assert_failure
346    Class XX — Internal Error
347    XX000      internal_error
348    XX001      data_corrupted
349    XX002      index_corrupted