[分享] PostgreSQL数据库中的常见错误_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2787 | 回复: 0   主题: [分享] PostgreSQL数据库中的常见错误        下一篇 
java2job
注册用户
等级:列兵
经验:88
发帖:1
精华:0
注册:2015-10-17
状态:离线
发送短消息息给java2job 加好友    发送短消息息给java2job 发消息
发表于: IP:您无权察看 2016-4-14 14:04:08 | [全部帖] [楼主帖] 楼主

我们在操作数据库的时候,我们总会遇到很多错误。下面整理了一下常见的错误。

错误1

      FATAL: connection limit exceeded for non-superusers

      原因:非超级用户的连接数(max_connections - superuser_reserved_connections)超过了设定值

      解决办法:增加max_connections设定值,但如果增加了过多的话,数据库负担太大还容易产生内存错误。可以记住pg-pool等工具来辅助解决。

错误2

     FATAL: sorry, too many clients already

     原因:数据库服务器的连接数超过了max_connections设定值。

     解决办法:和错误1解决办法类似。

错误3

    LOG: checkpoints are occurring too frequently

    原因:checkpoint处理正频繁发生。

    解决办法:增加checkpoint_segments的值。

错误4

    LOG: archive command failed with exit code (X)

    原因:archive_command失败了。

    解决办法:因为有可能是硬盘没空间了,所以可以把数据库的log删除一些。

错误5

    LOG: number of page slots needed (X) exceeds max_fsm_pages (Y)

    原因:max_fsm_pages不足了。

    解决办法:增加max_fsm_pages的同时进行VACUUM FULL。

错误6

   ERROR: current transaction is aborted, commands ignored until end of transaction blockp
   原因:数据库操作时,前一次操作中已经发生过错误了。

   解决办法:包级:ERROR: current transaction is aborted, commands ignored until end of transaction blockp

错误7

   ERROR:  operator does not exist: character = integer

   原因:8.3以后,取消了默认类型转换。因此需要使比较的类型保持一致。可以看cast函数。

 

 

附错误code

 

Error CodeMeaningCondition Name
Class 00 — Successful Completion
00000SUCCESSFUL COMPLETIONsuccessful_completion
Class 01 — Warning
01000WARNINGwarning
0100CDYNAMIC RESULT SETS RETURNEDdynamic_result_sets_returned
01008IMPLICIT ZERO BIT PADDINGimplicit_zero_bit_padding
01003NULL VALUE ELIMINATED IN SET FUNCTIONnull_value_eliminated_in_set_function
01007PRIVILEGE NOT GRANTEDprivilege_not_granted
01006PRIVILEGE NOT REVOKEDprivilege_not_revoked
01004STRING DATA RIGHT TRUNCATIONstring_data_right_truncation
01P01DEPRECATED FEATUREdeprecated_feature
Class 02 — No Data (this is also a warning class per the SQL standard)
02000NO DATAno_data
02001NO ADDITIONAL DYNAMIC RESULT SETS RETURNEDno_additional_dynamic_result_sets_returned
Class 03 — SQL Statement Not Yet Complete
03000SQL STATEMENT NOT YET COMPLETEsql_statement_not_yet_complete
Class 08 — Connection Exception
08000CONNECTION EXCEPTIONconnection_exception
08003CONNECTION DOES NOT EXISTconnection_does_not_exist
08006CONNECTION FAILUREconnection_failure
08001SQLCLIENT UNABLE TO ESTABLISH SQLCONNECTIONsqlclient_unable_to_establish_sqlconnection
08004SQLSERVER REJECTED ESTABLISHMENT OF SQLCONNECTIONsqlserver_rejected_establishment_of_sqlconnection
08007TRANSACTION RESOLUTION UNKNOWNtransaction_resolution_unknown
08P01PROTOCOL VIOLATIONprotocol_violation
Class 09 — Triggered Action Exception
09000TRIGGERED ACTION EXCEPTIONtriggered_action_exception
Class 0A — Feature Not Supported
0A000FEATURE NOT SUPPORTEDfeature_not_supported
Class 0B — Invalid Transaction Initiation
0B000INVALID TRANSACTION INITIATIONinvalid_transaction_initiation
Class 0F — Locator Exception
0F000LOCATOR EXCEPTIONlocator_exception
0F001INVALID LOCATOR SPECIFICATIONinvalid_locator_specification
Class 0L — Invalid Grantor
0L000INVALID GRANTORinvalid_grantor
0LP01INVALID GRANT OPERATIONinvalid_grant_operation
Class 0P — Invalid Role Specification
0P000INVALID ROLE SPECIFICATIONinvalid_role_specification
Class 20 — Case Not Found
20000CASE NOT FOUNDcase_not_found
Class 21 — Cardinality Violation
21000CARDINALITY VIOLATIONcardinality_violation
Class 22 — Data Exception
22000DATA EXCEPTIONdata_exception
2202EARRAY SUBSCRIPT ERRORarray_subscript_error
22021CHARACTER NOT IN REPERTOIREcharacter_not_in_repertoire
22008DATETIME FIELD OVERFLOWdatetime_field_overflow
22012DIVISION BY ZEROdivision_by_zero
22005ERROR IN ASSIGNMENTerror_in_assignment
2200BESCAPE CHARACTER CONFLICTescape_character_conflict
22022INDICATOR OVERFLOWindicator_overflow
22015INTERVAL FIELD OVERFLOWinterval_field_overflow
2201EINVALID ARGUMENT FOR LOGARITHMinvalid_argument_for_logarithm
22014INVALID ARGUMENT FOR NTILE FUNCTIONinvalid_argument_for_ntile_function
22016INVALID ARGUMENT FOR NTH_VALUE FUNCTIONinvalid_argument_for_nth_value_function
2201FINVALID ARGUMENT FOR POWER FUNCTIONinvalid_argument_for_power_function
2201GINVALID ARGUMENT FOR WIDTH BUCKET FUNCTIONinvalid_argument_for_width_bucket_function
22018INVALID CHARACTER VALUE FOR CASTinvalid_character_value_for_cast
22007INVALID DATETIME FORMATinvalid_datetime_format
22019INVALID ESCAPE CHARACTERinvalid_escape_character
2200DINVALID ESCAPE OCTETinvalid_escape_octet
22025INVALID ESCAPE SEQUENCEinvalid_escape_sequence
22P06NONSTANDARD USE OF ESCAPE CHARACTERnonstandard_use_of_escape_character
22010INVALID INDICATOR PARAMETER VALUEinvalid_indicator_parameter_value
22023INVALID PARAMETER VALUEinvalid_parameter_value
2201BINVALID REGULAR EXPRESSIONinvalid_regular_expression
2201WINVALID ROW COUNT IN LIMIT CLAUSEinvalid_row_count_in_limit_clause
2201XINVALID ROW COUNT IN RESULT OFFSET CLAUSEinvalid_row_count_in_result_offset_clause
22009INVALID TIME ZONE DISPLACEMENT VALUEinvalid_time_zone_displacement_value
2200CINVALID USE OF ESCAPE CHARACTERinvalid_use_of_escape_character
2200GMOST SPECIFIC TYPE MISMATCHmost_specific_type_mismatch
22004NULL VALUE NOT ALLOWEDnull_value_not_allowed
22002NULL VALUE NO INDICATOR PARAMETERnull_value_no_indicator_parameter
22003NUMERIC VALUE OUT OF RANGEnumeric_value_out_of_range
22026STRING DATA LENGTH MISMATCHstring_data_length_mismatch
22001STRING DATA RIGHT TRUNCATIONstring_data_right_truncation
22011SUBSTRING ERRORsubstring_error
22027TRIM ERRORtrim_error
22024UNTERMINATED C STRINGunterminated_c_string
2200FZERO LENGTH CHARACTER STRINGzero_length_character_string
22P01FLOATING POINT EXCEPTIONfloating_point_exception
22P02INVALID TEXT REPRESENTATIONinvalid_text_representation
22P03INVALID BINARY REPRESENTATIONinvalid_binary_representation
22P04BAD COPY FILE FORMATbad_copy_file_format
22P05UNTRANSLATABLE CHARACTERuntranslatable_character
2200LNOT AN XML DOCUMENTnot_an_xml_document
2200MINVALID XML DOCUMENTinvalid_xml_document
2200NINVALID XML CONTENTinvalid_xml_content
2200SINVALID XML COMMENTinvalid_xml_comment
2200TINVALID XML PROCESSING INSTRUCTIONinvalid_xml_processing_instruction
Class 23 — Integrity Constraint Violation
23000INTEGRITY CONSTRAINT VIOLATIONintegrity_constraint_violation
23001RESTRICT VIOLATIONrestrict_violation
23502NOT NULL VIOLATIONnot_null_violation
23503FOREIGN KEY VIOLATIONforeign_key_violation
23505UNIQUE VIOLATIONunique_violation
23514CHECK VIOLATIONcheck_violation
Class 24 — Invalid Cursor State
24000INVALID CURSOR STATEinvalid_cursor_state
Class 25 — Invalid Transaction State
25000INVALID TRANSACTION STATEinvalid_transaction_state
25001ACTIVE SQL TRANSACTIONactive_sql_transaction
25002BRANCH TRANSACTION ALREADY ACTIVEbranch_transaction_already_active
25008HELD CURSOR REQUIRES SAME ISOLATION LEVELheld_cursor_requires_same_isolation_level
25003INAPPROPRIATE ACCESS MODE FOR BRANCH TRANSACTIONinappropriate_access_mode_for_branch_transaction
25004INAPPROPRIATE ISOLATION LEVEL FOR BRANCH TRANSACTIONinappropriate_isolation_level_for_branch_transaction
25005NO ACTIVE SQL TRANSACTION FOR BRANCH TRANSACTIONno_active_sql_transaction_for_branch_transaction
25006READ ONLY SQL TRANSACTIONread_only_sql_transaction
25007SCHEMA AND DATA STATEMENT MIXING NOT SUPPORTEDschema_and_data_statement_mixing_not_supported
25P01NO ACTIVE SQL TRANSACTIONno_active_sql_transaction
25P02IN FAILED SQL TRANSACTIONin_failed_sql_transaction
Class 26 — Invalid SQL Statement Name
26000INVALID SQL STATEMENT NAMEinvalid_sql_statement_name
Class 27 — Triggered Data Change Violation
27000TRIGGERED DATA CHANGE VIOLATIONtriggered_data_change_violation
Class 28 — Invalid Authorization Specification
28000INVALID AUTHORIZATION SPECIFICATIONinvalid_authorization_specification
Class 2B — Dependent Privilege Descriptors Still Exist
2B000DEPENDENT PRIVILEGE DESCRIPTORS STILL EXISTdependent_privilege_descriptors_still_exist
2BP01DEPENDENT OBJECTS STILL EXISTdependent_objects_still_exist
Class 2D — Invalid Transaction Termination
2D000INVALID TRANSACTION TERMINATIONinvalid_transaction_termination
Class 2F — SQL Routine Exception
2F000SQL ROUTINE EXCEPTIONsql_routine_exception
2F005FUNCTION EXECUTED NO RETURN STATEMENTfunction_executed_no_return_statement
2F002MODIFYING SQL DATA NOT PERMITTEDmodifying_sql_data_not_permitted
2F003PROHIBITED SQL STATEMENT ATTEMPTEDprohibited_sql_statement_attempted
2F004READING SQL DATA NOT PERMITTEDreading_sql_data_not_permitted
Class 34 — Invalid Cursor Name
34000INVALID CURSOR NAMEinvalid_cursor_name
Class 38 — External Routine Exception
38000EXTERNAL ROUTINE EXCEPTIONexternal_routine_exception
38001CONTAINING SQL NOT PERMITTEDcontaining_sql_not_permitted
38002MODIFYING SQL DATA NOT PERMITTEDmodifying_sql_data_not_permitted
38003PROHIBITED SQL STATEMENT ATTEMPTEDprohibited_sql_statement_attempted
38004READING SQL DATA NOT PERMITTEDreading_sql_data_not_permitted
Class 39 — External Routine Invocation Exception
39000EXTERNAL ROUTINE INVOCATION EXCEPTIONexternal_routine_invocation_exception
39001INVALID SQLSTATE RETURNEDinvalid_sqlstate_returned
39004NULL VALUE NOT ALLOWEDnull_value_not_allowed
39P01TRIGGER PROTOCOL VIOLATEDtrigger_protocol_violated
39P02SRF PROTOCOL VIOLATEDsrf_protocol_violated
Class 3B — Savepoint Exception
3B000SAVEPOINT EXCEPTIONsavepoint_exception
3B001INVALID SAVEPOINT SPECIFICATIONinvalid_savepoint_specification
Class 3D — Invalid Catalog Name
3D000INVALID CATALOG NAMEinvalid_catalog_name
Class 3F — Invalid Schema Name
3F000INVALID SCHEMA NAMEinvalid_schema_name
Class 40 — Transaction Rollback
40000TRANSACTION ROLLBACKtransaction_rollback
40002TRANSACTION INTEGRITY CONSTRAINT VIOLATIONtransaction_integrity_constraint_violation
40001SERIALIZATION FAILUREserialization_failure
40003STATEMENT COMPLETION UNKNOWNstatement_completion_unknown
40P01DEADLOCK DETECTEDdeadlock_detected
Class 42 — Syntax Error or Access Rule Violation
42000SYNTAX ERROR OR ACCESS RULE VIOLATIONsyntax_error_or_access_rule_violation
42601SYNTAX ERRORsyntax_error
42501INSUFFICIENT PRIVILEGEinsufficient_privilege
42846CANNOT COERCEcannot_coerce
42803GROUPING ERRORgrouping_error
42P20WINDOWING ERRORwindowing_error
42P19INVALID RECURSIONinvalid_recursion
42830INVALID FOREIGN KEYinvalid_foreign_key
42602INVALID NAMEinvalid_name
42622NAME TOO LONGname_too_long
42939RESERVED NAMEreserved_name
42804DATATYPE MISMATCHdatatype_mismatch
42P18INDETERMINATE DATATYPEindeterminate_datatype
42809WRONG OBJECT TYPEwrong_object_type
42703UNDEFINED COLUMNundefined_column
42883UNDEFINED FUNCTIONundefined_function
42P01UNDEFINED TABLEundefined_table
42P02UNDEFINED PARAMETERundefined_parameter
42704UNDEFINED OBJECTundefined_object
42701DUPLICATE COLUMNduplicate_column
42P03DUPLICATE CURSORduplicate_cursor
42P04DUPLICATE DATABASEduplicate_database
42723DUPLICATE FUNCTIONduplicate_function
42P05DUPLICATE PREPARED STATEMENTduplicate_prepared_statement
42P06DUPLICATE SCHEMAduplicate_schema
42P07DUPLICATE TABLEduplicate_table
42712DUPLICATE ALIASduplicate_alias
42710DUPLICATE OBJECTduplicate_object
42702AMBIGUOUS COLUMNambiguous_column
42725AMBIGUOUS FUNCTIONambiguous_function
42P08AMBIGUOUS PARAMETERambiguous_parameter
42P09AMBIGUOUS ALIASambiguous_alias
42P10INVALID COLUMN REFERENCEinvalid_column_reference
42611INVALID COLUMN DEFINITIONinvalid_column_definition
42P11INVALID CURSOR DEFINITIONinvalid_cursor_definition
42P12INVALID DATABASE DEFINITIONinvalid_database_definition
42P13INVALID FUNCTION DEFINITIONinvalid_function_definition
42P14INVALID PREPARED STATEMENT DEFINITIONinvalid_prepared_statement_definition
42P15INVALID SCHEMA DEFINITIONinvalid_schema_definition
42P16INVALID TABLE DEFINITIONinvalid_table_definition
42P17INVALID OBJECT DEFINITIONinvalid_object_definition
Class 44 — WITH CHECK OPTION Violation
44000WITH CHECK OPTION VIOLATIONwith_check_option_violation
Class 53 — Insufficient Resources
53000INSUFFICIENT RESOURCESinsufficient_resources
53100DISK FULLdisk_full
53200OUT OF MEMORYout_of_memory
53300TOO MANY CONNECTIONStoo_many_connections
Class 54 — Program Limit Exceeded
54000PROGRAM LIMIT EXCEEDEDprogram_limit_exceeded
54001STATEMENT TOO COMPLEXstatement_too_complex
54011TOO MANY COLUMNStoo_many_columns
54023TOO MANY ARGUMENTStoo_many_arguments
Class 55 — Object Not In Prerequisite State
55000OBJECT NOT IN PREREQUISITE STATEobject_not_in_prerequisite_state
55006OBJECT IN USEobject_in_use
55P02CANT CHANGE RUNTIME PARAMcant_change_runtime_param
55P03LOCK NOT AVAILABLElock_not_available
Class 57 — Operator Intervention
57000OPERATOR INTERVENTIONoperator_intervention
57014QUERY CANCELEDquery_canceled
57P01ADMIN SHUTDOWNadmin_shutdown
57P02CRASH SHUTDOWNcrash_shutdown
57P03CANNOT CONNECT NOWcannot_connect_now
Class 58 — System Error (errors external to itself)
58030IO ERRORio_error
58P01UNDEFINED FILEundefined_file
58P02DUPLICATE FILEduplicate_file
Class F0 — Configuration File Error
F0000CONFIG FILE ERRORconfig_file_error
F0001LOCK FILE EXISTSlock_file_exists
Class P0 — PL/pgSQL Error
P0000PLPGSQL ERRORplpgsql_error
P0001RAISE EXCEPTIONraise_exception
P0002NO DATA FOUNDno_data_found
P0003TOO MANY ROWStoo_many_rows
Class XX — Internal Error
XX000INTERNAL ERRORinternal_error
XX001DATA CORRUPTEDdata_corrupted
XX002INDEX CORRUPTEDindex_corrupted





赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论