你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
nccloud
PostgreSQL服务器发出的所有消息都被赋予了五个字符错误代码,这遵循 SQL 标准对“SQLSTATE”代码的习惯。需要知道发生了什么错误条件的应用通常应该测试错误代码, 而不是查看文本形式的错误消息。这些错误代码轻易不会在PostgreSQL的版本之间改变,并且一般也不会随着错误消息的本地化而改变。请注意有些(但不是全部)PostgreSQL生成的错误代码是由 SQL 标准定义的;有些标准没有定义的额外错误代码是PostgreSQL发明的或者是从其它数据库借用的。
根据标准,错误代码的前两个字符表示错误类别,而后三个字符表示在该类别内的一种特定情况。因此, 那些不能识别特定错误代码的应用仍然可以从错误类别中推断要做什么。
表 A.1中列出了PostgreSQL 12.2定义的所有错误代码(有些实际上目前并没有使用,但是 SQL 标准中有定义)。错误类别也在其中列出。对于每个错误类别都有一个 “标准”错误代码,它的最后三个字符是000。这个代码只用于那些属于该类别但是没有被赋予更特定代码的错误情况。
000
“情况名称”列中显示的符号是在PL/pgSQL中使用的情况名称。情况名称可以被写成大写或小写形式(注意PL/pgSQL不识别警告(与错误不同)情况名称,它们是类别 00、01 和 02)。
对于某些类型的错误,服务器会报告与错误相关的数据库对象(一个表、表列、数据类型或约束)的名称。例如,导致一个unique_violation错误的唯一约束的名称。这些名字被包含在错误报告消息的独立域中,这样应用就不必从可能是本地化的人类可读的消息文本中抽取它们。到PostgreSQL 9.3 位置,对于这个特性的完全覆盖只在 SQLSTATE 类别 23 (完整性约束未被)的错误中存在,但是很可能会在未来进行扩展。
unique_violation
表 A.1. PostgreSQL错误代码
00000
successful_completion
01000
warning
0100C
dynamic_result_sets_returned
01008
implicit_zero_bit_padding
01003
null_value_eliminated_in_set_function
01007
privilege_not_granted
01006
privilege_not_revoked
01004
string_data_right_truncation
01P01
deprecated_feature
02000
no_data
02001
no_additional_dynamic_result_sets_returned
03000
sql_statement_not_yet_complete
08000
connection_exception
08003
connection_does_not_exist
08006
connection_failure
08001
sqlclient_unable_to_establish_sqlconnection
08004
sqlserver_rejected_establishment_of_sqlconnection
08007
transaction_resolution_unknown
08P01
protocol_violation
09000
triggered_action_exception
0A000
feature_not_supported
0B000
invalid_transaction_initiation
0F000
locator_exception
0F001
invalid_locator_specification
0L000
invalid_grantor
0LP01
invalid_grant_operation
0P000
invalid_role_specification
0Z000
diagnostics_exception
0Z002
stacked_diagnostics_accessed_without_active_handler
20000
case_not_found
21000
cardinality_violation
22000
data_exception
2202E
array_subscript_error
22021
character_not_in_repertoire
22008
datetime_field_overflow
22012
division_by_zero
22005
error_in_assignment
2200B
escape_character_conflict
22022
indicator_overflow
22015
interval_field_overflow
2201E
invalid_argument_for_logarithm
22014
invalid_argument_for_ntile_function
22016
invalid_argument_for_nth_value_function
2201F
invalid_argument_for_power_function
2201G
invalid_argument_for_width_bucket_function
22018
invalid_character_value_for_cast
22007
invalid_datetime_format
22019
invalid_escape_character
2200D
invalid_escape_octet
22025
invalid_escape_sequence
22P06
nonstandard_use_of_escape_character
22010
invalid_indicator_parameter_value
22023
invalid_parameter_value
22013
invalid_preceding_or_following_size
2201B
invalid_regular_expression
2201W
invalid_row_count_in_limit_clause
2201X
invalid_row_count_in_result_offset_clause
2202H
invalid_tablesample_argument
2202G
invalid_tablesample_repeat
22009
invalid_time_zone_displacement_value
2200C
invalid_use_of_escape_character
2200G
most_specific_type_mismatch
22004
null_value_not_allowed
22002
null_value_no_indicator_parameter
22003
numeric_value_out_of_range
2200H
sequence_generator_limit_exceeded
22026
string_data_length_mismatch
22001
22011
substring_error
22027
trim_error
22024
unterminated_c_string
2200F
zero_length_character_string
22P01
floating_point_exception
22P02
invalid_text_representation
22P03
invalid_binary_representation
22P04
bad_copy_file_format
22P05
untranslatable_character
2200L
not_an_xml_document
2200M
invalid_xml_document
2200N
invalid_xml_content
2200S
invalid_xml_comment
2200T
invalid_xml_processing_instruction
22030
duplicate_json_object_key_value
22032
invalid_json_text
22033
invalid_sql_json_subscript
22034
more_than_one_sql_json_item
22035
no_sql_json_item
22036
non_numeric_sql_json_item
22037
non_unique_keys_in_a_json_object
22038
singleton_sql_json_item_required
22039
sql_json_array_not_found
2203A
sql_json_member_not_found
2203B
sql_json_number_not_found
2203C
sql_json_object_not_found
2203D
too_many_json_array_elements
要回复问题请先登录或注册
1 个回复
nccloud
附录 A. PostgreSQL错误代码
PostgreSQL服务器发出的所有消息都被赋予了五个字符错误代码,这遵循 SQL 标准对“SQLSTATE”代码的习惯。需要知道发生了什么错误条件的应用通常应该测试错误代码, 而不是查看文本形式的错误消息。这些错误代码轻易不会在PostgreSQL的版本之间改变,并且一般也不会随着错误消息的本地化而改变。请注意有些(但不是全部)PostgreSQL生成的错误代码是由 SQL 标准定义的;有些标准没有定义的额外错误代码是PostgreSQL发明的或者是从其它数据库借用的。
根据标准,错误代码的前两个字符表示错误类别,而后三个字符表示在该类别内的一种特定情况。因此, 那些不能识别特定错误代码的应用仍然可以从错误类别中推断要做什么。
表 A.1中列出了PostgreSQL 12.2定义的所有错误代码(有些实际上目前并没有使用,但是 SQL 标准中有定义)。错误类别也在其中列出。对于每个错误类别都有一个 “标准”错误代码,它的最后三个字符是
000
。这个代码只用于那些属于该类别但是没有被赋予更特定代码的错误情况。“情况名称”列中显示的符号是在PL/pgSQL中使用的情况名称。情况名称可以被写成大写或小写形式(注意PL/pgSQL不识别警告(与错误不同)情况名称,它们是类别 00、01 和 02)。
对于某些类型的错误,服务器会报告与错误相关的数据库对象(一个表、表列、数据类型或约束)的名称。例如,导致一个
unique_violation
错误的唯一约束的名称。这些名字被包含在错误报告消息的独立域中,这样应用就不必从可能是本地化的人类可读的消息文本中抽取它们。到PostgreSQL 9.3 位置,对于这个特性的完全覆盖只在 SQLSTATE 类别 23 (完整性约束未被)的错误中存在,但是很可能会在未来进行扩展。表 A.1. PostgreSQL错误代码
00000
successful_completion
01000
warning
0100C
dynamic_result_sets_returned
01008
implicit_zero_bit_padding
01003
null_value_eliminated_in_set_function
01007
privilege_not_granted
01006
privilege_not_revoked
01004
string_data_right_truncation
01P01
deprecated_feature
02000
no_data
02001
no_additional_dynamic_result_sets_returned
03000
sql_statement_not_yet_complete
08000
connection_exception
08003
connection_does_not_exist
08006
connection_failure
08001
sqlclient_unable_to_establish_sqlconnection
08004
sqlserver_rejected_establishment_of_sqlconnection
08007
transaction_resolution_unknown
08P01
protocol_violation
09000
triggered_action_exception
0A000
feature_not_supported
0B000
invalid_transaction_initiation
0F000
locator_exception
0F001
invalid_locator_specification
0L000
invalid_grantor
0LP01
invalid_grant_operation
0P000
invalid_role_specification
0Z000
diagnostics_exception
0Z002
stacked_diagnostics_accessed_without_active_handler
20000
case_not_found
21000
cardinality_violation
22000
data_exception
2202E
array_subscript_error
22021
character_not_in_repertoire
22008
datetime_field_overflow
22012
division_by_zero
22005
error_in_assignment
2200B
escape_character_conflict
22022
indicator_overflow
22015
interval_field_overflow
2201E
invalid_argument_for_logarithm
22014
invalid_argument_for_ntile_function
22016
invalid_argument_for_nth_value_function
2201F
invalid_argument_for_power_function
2201G
invalid_argument_for_width_bucket_function
22018
invalid_character_value_for_cast
22007
invalid_datetime_format
22019
invalid_escape_character
2200D
invalid_escape_octet
22025
invalid_escape_sequence
22P06
nonstandard_use_of_escape_character
22010
invalid_indicator_parameter_value
22023
invalid_parameter_value
22013
invalid_preceding_or_following_size
2201B
invalid_regular_expression
2201W
invalid_row_count_in_limit_clause
2201X
invalid_row_count_in_result_offset_clause
2202H
invalid_tablesample_argument
2202G
invalid_tablesample_repeat
22009
invalid_time_zone_displacement_value
2200C
invalid_use_of_escape_character
2200G
most_specific_type_mismatch
22004
null_value_not_allowed
22002
null_value_no_indicator_parameter
22003
numeric_value_out_of_range
2200H
sequence_generator_limit_exceeded
22026
string_data_length_mismatch
22001
string_data_right_truncation
22011
substring_error
22027
trim_error
22024
unterminated_c_string
2200F
zero_length_character_string
22P01
floating_point_exception
22P02
invalid_text_representation
22P03
invalid_binary_representation
22P04
bad_copy_file_format
22P05
untranslatable_character
2200L
not_an_xml_document
2200M
invalid_xml_document
2200N
invalid_xml_content
2200S
invalid_xml_comment
2200T
invalid_xml_processing_instruction
22030
duplicate_json_object_key_value
22032
invalid_json_text
22033
invalid_sql_json_subscript
22034
more_than_one_sql_json_item
22035
no_sql_json_item
22036
non_numeric_sql_json_item
22037
non_unique_keys_in_a_json_object
22038
singleton_sql_json_item_required
22039
sql_json_array_not_found
2203A
sql_json_member_not_found
2203B
sql_json_number_not_found
2203C
sql_json_object_not_found
2203D
too_many_json_array_elements
要回复问题请先登录或注册
发起人
问题状态