SeaboxSQL错误代码
错误代码¶
SeaboxSQL服务发出的所有消息都被赋予了五个字符错误代码,这遵循SQL标准对“SQLSTATE”代码的习惯。需要知道发生了什么错误条件的应用通常应该测试错误代码,而不是查看文本形式的错误消息。这些错误代码轻易不会在SeaboxSQL的版本之间改变,并且一般也不会随着错误消息的本地化而改变。请注意有些(但不是全部)SeaboxSQL生成的错误代码是由SQL标准定义的;有些标准没有定义的额外错误代码是SeaboxSQL发明的或者是从其它数据库借用的。
根据标准,错误代码的前两个字符表示错误类别,而后三个字符表示在该类别内的一种特定情况。因此,那些不能识别特定错误代码的应用仍然可以从错误类别中推断要做什么。
"表 错误代码表"中列出了SeaboxSQL定义的所有错误代码(有些实际上目前并没有使用,但是 SQL 标准中有定义)。错误类别也在其中列出。对于每个错误类别都有一个“标准”错误代码,它的最后三个字符是000
。这个代码只用于那些属于该类别但是没有被赋予更特定代码的错误情况。
“情况名称”列中显示的符号是在PL/pgSQL中使用的情况名称。情况名称可以被写成大写或小写形式(注意PL/pgSQL不识别警告(与错误不同)情况名称,它们是类别00、01 和 02)。
对于某些类型的错误,服务会报告与错误相关的数据库对象(一个表、表列、数据类型或约束)的名称。例如,导致一个unique_violation
错误的唯一约束的名称。这些名字被包含在错误报告消息的独立域中,这样应用就不必从可能是本地化的人类可读的消息文本中抽取它们。
Class 00 — Successful Completion¶
错误类型:执行成功
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
0 | successful_completion | 成功 |
Class 01 — Warning¶
错误类型:执行成功,返回警告
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
1000 | warning | 警告 |
0100C | dynamic_result_sets_returned | 返回了动态结果 |
1008 | implicit_zero_bit_padding | 警告,隐含补齐了零比特位 |
1003 | null_value_eliminated_in_set_function | 在集合函数里消除了空值 |
1007 | privilege_not_granted | 没有赋予权限 |
1006 | privilege_not_revoked | 没有撤销权限 |
1004 | string_data_right_truncation | 字串数据在右端截断 |
01P01 | deprecated_feature | 废弃的特性 |
Class 02 — No Data¶
错误类型:没有数据 — 按照 SQL:1999 的要求,这也是警告类
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
2000 | no_data | 没有数据 |
2001 | no_additional_dynamic_result_sets_returned | 返回了没有附加动态结果集 |
Class 03 — SQL Statement Not Yet Complete¶
错误类型:SQL 语句尚未结束
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
3000 | sql_statement_not_yet_complete | SQL 语句尚未结束 |
Class 08 — Connection Exception¶
错误类型:连接例外
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
8000 | connection_exception | 连接例外 |
8003 | connection_does_not_exist | 连接不存在 |
8006 | connection_failure | 连接失败 |
8001 | sqlclient_unable_to_establish_sqlconnection | SQL 客户端不能建立 SQL 连接 |
8004 | sqlserver_rejected_establishment_of_sqlconnection | SQL 服务器拒绝建立 SQL 连接 |
8007 | transaction_resolution_unknown | 未知的事务解析 |
08P01 | protocol_violation | 违反协议 |
Class 09 — Triggered Action Exception¶
错误类型:触发器动作列外
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
9000 | triggered_action_exception | 触发的动作例外 |
Class 0A — Feature Not Supported¶
错误类型:不支持特性
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
0A000 | feature_not_supported | 不支持此特性 |
Class 0B — Invalid Transaction Initiation¶
错误类型:非法事务初始化
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
0B000 | invalid_transaction_initiation | 非法事务初始化 |
Class 0F — Locator Exception¶
错误类型:指示器例外
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
0F000 | locator_exception | 指示器例外 |
0F001 | invalid_locator_specification | 非法的定位器声明 |
Class 0L — Invalid Grantor¶
错误类型:非法赋权人
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
0L000 | invalid_grantor | 非法赋权人 |
0LP01 | invalid_grant_operation | 非法赋权操作 |
Class 0P — Invalid Role Specification¶
错误类型:非法角色声明
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
0P000 | invalid_role_specification | 非法角色声明 |
Class 0Z — Diagnostics Exception¶
错误类型:诊断异常
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
0Z000 | diagnostics_exception | 诊断异常 |
0Z002 | stacked_diagnostics_accessed_without_active_handler | 不使用活动处理程序访问的堆栈诊断 |
Class 20 — Case Not Found¶
错误类型:用例未找到
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
20000 | case_not_found | 用例未找到 |
Class 21 — Cardinality Violation¶
错误类型:基数冲突
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
21000 | cardinality_violation | 基数冲突 |
Class 22 — Data Exception¶
错误类型:数据例外
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
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 | NTILE函数的非法参数 |
22016 | invalid_argument_for_nth_value_function | N值函数的非法参数 |
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 | LIMIT子句中行号非法 |
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 | 不允许 NULL 值 |
22002 | null_value_no_indicator_parameter | NULL 值不能做指示器参数 |
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 | 未结束的 C 字串 |
2200F | zero_length_character_string | 零长度的字符串 |
22P01 | floating_point_exception | 浮点例外 |
22P02 | invalid_text_representation | 非法文本表现形式 |
22P03 | invalid_binary_representation | 非法二进制表现形式 |
22P04 | bad_copy_file_format | 错误的 COPY 格式 |
22P05 | untranslatable_character | 不可翻译字符 |
2200L | not_an_xml_document | 非XML文件 |
2200M | invalid_xml_document | 非法的XML文件 |
2200N | invalid_xml_content | 非法的XML内容 |
2200S | invalid_xml_comment | 非法的XML注释 |
2200T | invalid_xml_processing_instruction | 非法的XML处理命令 |
Class 23 — Integrity Constraint Violation¶
错误类型:违反完整性约束
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
23000 | integrity_constraint_violation | 违反完整性约束 |
23001 | restrict_violation | 违反限制 |
23502 | not_null_violation | 违反非空 |
23503 | foreign_key_violation | 违反外键约束 |
23505 | unique_violation | 违反唯一约束 |
23514 | check_violation | 违反检查 |
23P01 | exclusion_violation | 违反排他约束 |
Class 24 — Invalid Cursor State¶
错误类型:非法游标状态
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
24000 | invalid_cursor_state | 非法游标状态 |
Class 25 — Invalid Transaction State¶
错误类型:非法事务状态
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
25000 | invalid_transaction_state | 非法事务状态 |
25001 | active_sql_transaction | 活跃的 SQL 状态 |
25002 | branch_transaction_already_active | 分支事务已经激活 |
25008 | held_cursor_requires_same_isolation_level | 持有的游标要求同样的隔离级别 |
25003 | inappropriate_access_mode_for_branch_transaction | 对分支事务的不恰当的访问方式 |
25004 | inappropriate_isolation_level_for_branch_transaction | 对分支事务的不恰当的隔离级别 |
25005 | no_active_sql_transaction_for_branch_transaction | 分支事务没有活跃的 SQL 事务 |
25006 | read_only_sql_transaction | 只读的 SQL 事务 |
25007 | schema_and_data_statement_mixing_not_supported | 不支持混和的模式和数据语句 |
25P01 | no_active_sql_transaction | 没有活跃的 SQL 事务 |
25P02 | in_failed_sql_transaction | 在失败的 SQL 事务中 |
25P03 | idle_in_transaction_session_timeout | 事务session空闲超时 |
Class 26 — Invalid SQL Statement Name¶
错误类型:非法 SQL 语句名
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
26000 | invalid_sql_statement_name | 非法 SQL 语句名 |
Class 27 — Triggered Data Change Violation¶
错误类型:触发的数据改变违规
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
27000 | triggered_data_change_violation | 触发的数据改变违规 |
Class 28 — Invalid Authorization Specification¶
错误类型:非法授权声明
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
28000 | invalid_authorization_specification | 非法授权声明 |
28P01 | invalid_password | 非法密码 |
Class 2B — Dependent Privilege Descriptors Still Exist¶
错误类型:依然存在依赖的优先级描述符
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
2B000 | dependent_privilege_descriptors_still_exist | 依然存在依赖的优先级描述符 |
2BP01 | dependent_objects_still_exist | 依赖性对象仍然存在 |
Class 2D — Invalid Transaction Termination¶
错误类型:非法的事务终止
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
2D000 | invalid_transaction_termination | 非法的事务终止 |
Class 2F — SQL Routine Exception¶
错误类型:SQL 过程例外
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
2F000 | sql_routine_exception | SQL 过程例外 |
2F005 | function_executed_no_return_statement | 执行的函数没有返回语句 |
2F002 | modifying_sql_data_not_permitted | 不允许修改 SQL 数据 |
2F003 | prohibited_sql_statement_attempted | 企图使用禁止的 SQL 语句 |
2F004 | reading_sql_data_not_permitted | 不允许读取 SQL 数据 |
Class 34 — Invalid Cursor Name¶
错误类型:非法游标名
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
34000 | invalid_cursor_name | 非法游标名 |
Class 38 — External Routine Exception¶
错误类型:外部过程例外
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
38000 | external_routine_exception | 外部过程例外 |
38001 | containing_sql_not_permitted | 不允许包含的 SQL |
38002 | modifying_sql_data_not_permitted | 不允许修改 SQL 数据 |
38003 | prohibited_sql_statement_attempted | 企图使用禁止的 SQL 语句 |
38004 | reading_sql_data_not_permitted | 不允许读取 SQL 数据 |
Class 39 — External Routine Invocation Exception¶
错误类型:外部过程调用例外
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
39000 | external_routine_invocation_exception | 外部过程调用例外 |
39001 | invalid_sqlstate_returned | 返回了非法的 SQLSTATE |
39004 | null_value_not_allowed | 不允许空值 |
39P01 | trigger_protocol_violated | 违反触发器协议 |
39P02 | srf_protocol_violated | 违反SRF协议 |
39P03 | event_trigger_protocol_violated | 事件触发器端口冲突 |
Class 3B — Savepoint Exception¶
错误类型:保存点例外
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
3B000 | savepoint_exception | 保存点例外 |
3B001 | invalid_savepoint_specification | 无效的保存点声明 |
Class 3D — Invalid Catalog Name¶
错误类型:非法数据库名
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
3D000 | invalid_catalog_name | 非法数据库名 |
Class 3F — Invalid Schema Name¶
错误类型:非法模式名
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
3F000 | invalid_schema_name | 非法模式名 |
Class 40 — Transaction Rollback¶
错误类型:事务回滚
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
40000 | transaction_rollback | 事务回滚 |
40002 | transaction_integrity_constraint_violation | 违反事务完整性约束 |
40001 | serialization_failure | 串行化失败 |
40003 | statement_completion_unknown | 不知道语句是否结束 |
40P01 | deadlock_detected | 侦测到死锁 |
Class 42 — Syntax Error or Access Rule Violation¶
错误类型:语法错误或者违反访问规则
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
42000 | syntax_error_or_access_rule_violation | 语法错误或者违反访问规则 |
42601 | syntax_error | 语法错误 |
42501 | insufficient_privilege | 权限不够 |
42846 | cannot_coerce | 无法进行类型转换 |
42803 | grouping_error | 分组错误 |
42P20 | windowing_error | 窗口错误 |
42P19 | invalid_recursion | 无效递归 |
42830 | invalid_foreign_key | 非法的外键 |
42602 | invalid_name | 非法名字 |
42622 | name_too_long | 名字太长 |
42939 | reserved_name | 保留名字 |
42804 | datatype_mismatch | 数据类型不匹配 |
42P18 | indeterminate_datatype | 未决的数据类型 |
42P21 | collation_mismatch | 排序规则不匹配 |
42P22 | indeterminate_collation | 不确定的排序规则 |
42809 | wrong_object_type | 错误的对象类型 |
428C9 | generated_always | 已经生成 |
42703 | undefined_column | 未定义的字段 |
42883 | undefined_function | 未定义的函数 |
42P01 | undefined_table | 未定义的表 |
42P02 | undefined_parameter | 未定义的参数 |
42704 | undefined_object | 未定义对象 |
42701 | duplicate_column | 重复的字段 |
42P03 | duplicate_cursor | 重复的游标 |
42P04 | duplicate_database | 重复的数据库 |
42723 | duplicate_function | 重复的函数 |
42P05 | duplicate_prepared_statement | 重复的准备好语句 |
42P06 | duplicate_schema | 重复的模式 |
42P07 | duplicate_table | 重复的表 |
42712 | duplicate_alias | 重复的别名 |
42710 | duplicate_object | 重复的对象 |
42702 | ambiguous_column | 模糊的字段 |
42725 | ambiguous_function | 模糊的函数 |
42P08 | ambiguous_parameter | 模糊的参数 |
42P09 | ambiguous_alias | 模糊的别名 |
42P10 | invalid_column_reference | 非法字段引用 |
42611 | invalid_column_definition | 非法字段定义 |
42P11 | invalid_cursor_definition | 非法游标定义 |
42P12 | invalid_database_definition | 非法的数据库定义 |
42P13 | invalid_function_definition | 非法函数定义 |
42P14 | invalid_prepared_statement_definition | 非法准备好语句定义 |
42P15 | invalid_schema_definition | 非法模式定义 |
42P16 | invalid_table_definition | 非法表定义 |
42P17 | invalid_object_definition | 非法对象定义 |
Class 44 — WITH CHECK OPTION Violation¶
错误类型:违反 WITH CHECK 选项
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
44000 | with_check_option_violation | 违反 WITH CHECK 选项 |
Class 53 — Insufficient Resources¶
错误类型:资源不够
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
53000 | insufficient_resources | 资源不够 |
53100 | disk_full | 磁盘满 |
53200 | out_of_memory | 内存耗尽 |
53300 | too_many_connections | 太多连接 |
53400 | configuration_limit_exceeded | 超过配置限制 |
Class 54 — Program Limit Exceeded¶
错误类型:超过程序限制
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
54000 | program_limit_exceeded | 超过程序限制 |
54001 | statement_too_complex | 语句太复杂 |
54011 | too_many_columns | 太多字段 |
54023 | too_many_arguments | 参数太多 |
Class 55 — Object Not In Prerequisite State¶
错误类型:对象不在预先要求的状态
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
55000 | object_not_in_prerequisite_state | 对象不在预先要求的状态 |
55006 | object_in_use | 对象在使用中 |
55P02 | cant_change_runtime_param | 无法修改运行时参数 |
55P03 | lock_not_available | 锁不可获得 |
Class 57 — Operator Intervention¶
错误类型:操作者干涉
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
57000 | operator_intervention | 操作者干涉 |
57014 | query_canceled | 查询被取消 |
57P01 | admin_shutdown | 管理员关机 |
57P02 | crash_shutdown | 崩溃关机 |
57P03 | cannot_connect_now | 现在无法连接 |
57P04 | database_dropped | 丢弃数据库 |
Class 58 — System Error (errors external to Database itself)¶
错误类型:系统错误( SeaboxSQL 自己内部的错误)
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
58000 | system_error | 系统错误 |
58030 | io_error | IO 错误 |
58P01 | undefined_file | 未定义的文件 |
58P02 | duplicate_file | 重复的文件 |
Class 72 — Snapshot Failure¶
错误类型:快照失败
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
72000 | snapshot_too_old | 快照太旧 |
Class F0 — Configuration File Error¶
错误类型:配置文件错误
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
F0000 | config_file_error | 配置文件错误 |
F0001 | lock_file_exists | 锁文件存在 |
Class HV — Foreign Data Wrapper Error (SQL/MED)¶
错误类型:外部数据错误
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
HV000 | fdw_error | 外部数据错误 |
HV005 | fdw_column_name_not_found | 未找到列名 |
HV002 | fdw_dynamic_parameter_value_needed | 需要动态参数值 |
HV010 | fdw_function_sequence_error | 函数序列错误 |
HV021 | fdw_inconsistent_descriptor_information | 描述信息不一致 |
HV024 | fdw_invalid_attribute_value | 非法属性值 |
HV007 | fdw_invalid_column_name | 非法列名称 |
HV008 | fdw_invalid_column_number | 非法列数 |
HV004 | fdw_invalid_data_type | 非法数据类型 |
HV006 | fdw_invalid_data_type_descriptors | 非法数据类型描述符 |
HV091 | fdw_invalid_descriptor_field_identifier | 非法字段标识符 |
HV00B | fdw_invalid_handle | 非法处理 |
HV00C | fdw_invalid_option_index | 非法索引选项 |
HV00D | fdw_invalid_option_name | 非法选项名称 |
HV090 | fdw_invalid_string_length_or_buffer_length | 非法字符串长度或缓冲区长度 |
HV00A | fdw_invalid_string_format | 非法字符长格式 |
HV009 | fdw_invalid_use_of_null_pointer | 非法使用NULL指针 |
HV014 | fdw_too_many_handles | 太多句柄 |
HV001 | fdw_out_of_memory | 内存耗尽 |
HV00P | fdw_no_schemas | 无模式 |
HV00J | fdw_option_name_not_found | 未找到选项名称 |
HV00K | fdw_reply_handle | 回复句柄 |
HV00Q | fdw_schema_not_found | 未找到模式 |
HV00R | fdw_table_not_found | 未找到表 |
HV00L | fdw_unable_to_create_execution | 无法建立执行 |
HV00M | fdw_unable_to_create_reply | 不能创建回复 |
HV00N | fdw_unable_to_establish_connection | 无法建立连接 |
Class P0 — PL/pgSQL Error¶
错误类型:PL/pgSQL 错误
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
P0000 | plpgsql_error | PLPGSQL 错误 |
P0001 | raise_exception | 抛出例外 |
P0002 | no_data_found | 未找到数据 |
P0003 | too_many_rows | 行太多 |
P0004 | assert_failure | FORALL需要DML操作 |
Class XX — Internal Error¶
错误类型:内部错误
错误代码表
错误代码 | 情况名称 | 错误说明 |
---|---|---|
XX000 | internal_error | 内部错误 |
XX001 | data_corrupted | 数据损坏 |
XX002 | index_corrupted | 索引损坏 |