diff --git a/codegen/src/sqlstate.rs b/codegen/src/sqlstate.rs index a609e5ca..791e47b1 100644 --- a/codegen/src/sqlstate.rs +++ b/codegen/src/sqlstate.rs @@ -1,8 +1,8 @@ -use std::fs::File; -use std::io::{Write, BufWriter}; -use std::path::Path; -use phf_codegen; use linked_hash_map::LinkedHashMap; +use phf_codegen; +use std::fs::File; +use std::io::{BufWriter, Write}; +use std::path::Path; const ERRCODES_TXT: &'static str = include_str!("errcodes.txt"); @@ -59,7 +59,6 @@ impl SqlState {{ pub fn code(&self) -> &str {{ &self.0 }} -}} " ).unwrap(); } @@ -70,14 +69,16 @@ fn make_consts(codes: &LinkedHashMap>, file: &mut BufWriter< write!( file, r#" -/// {code} -pub const {name}: SqlState = SqlState(Cow::Borrowed("{code}")); + /// {code} + pub const {name}: SqlState = SqlState(Cow::Borrowed("{code}")); "#, name = name, code = code, ).unwrap(); } } + + write!(file, "}}").unwrap(); } fn make_map(codes: &LinkedHashMap>, file: &mut BufWriter) { @@ -89,7 +90,7 @@ static SQLSTATE_MAP: phf::Map<&'static str, SqlState> = " ).unwrap(); let mut builder = phf_codegen::Map::new(); for (code, names) in codes { - builder.entry(&**code, &names[0]); + builder.entry(&**code, &format!("SqlState::{}", &names[0])); } builder.build(file).unwrap(); write!(file, ";\n").unwrap(); diff --git a/codegen/src/type_gen.rs b/codegen/src/type_gen.rs index 645dc493..0f742d69 100644 --- a/codegen/src/type_gen.rs +++ b/codegen/src/type_gen.rs @@ -261,14 +261,7 @@ fn make_impl(w: &mut BufWriter, types: &BTreeMap) { } fn make_consts(w: &mut BufWriter, types: &BTreeMap) { - write!( - w, - "pub mod consts {{ - use types::Type; - use types::type_gen::Inner; -", - ).unwrap(); - + write!(w, "impl Type {{").unwrap(); for type_ in types.values() { write!( w, diff --git a/postgres-shared/src/error/sqlstate.rs b/postgres-shared/src/error/sqlstate.rs index 6d5916eb..c8e3ec2e 100644 --- a/postgres-shared/src/error/sqlstate.rs +++ b/postgres-shared/src/error/sqlstate.rs @@ -19,749 +19,748 @@ impl SqlState { pub fn code(&self) -> &str { &self.0 } + + /// 00000 + pub const SUCCESSFUL_COMPLETION: SqlState = SqlState(Cow::Borrowed("00000")); + + /// 01000 + pub const WARNING: SqlState = SqlState(Cow::Borrowed("01000")); + + /// 0100C + pub const WARNING_DYNAMIC_RESULT_SETS_RETURNED: SqlState = SqlState(Cow::Borrowed("0100C")); + + /// 01008 + pub const WARNING_IMPLICIT_ZERO_BIT_PADDING: SqlState = SqlState(Cow::Borrowed("01008")); + + /// 01003 + pub const WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION: SqlState = SqlState(Cow::Borrowed("01003")); + + /// 01007 + pub const WARNING_PRIVILEGE_NOT_GRANTED: SqlState = SqlState(Cow::Borrowed("01007")); + + /// 01006 + pub const WARNING_PRIVILEGE_NOT_REVOKED: SqlState = SqlState(Cow::Borrowed("01006")); + + /// 01004 + pub const WARNING_STRING_DATA_RIGHT_TRUNCATION: SqlState = SqlState(Cow::Borrowed("01004")); + + /// 01P01 + pub const WARNING_DEPRECATED_FEATURE: SqlState = SqlState(Cow::Borrowed("01P01")); + + /// 02000 + pub const NO_DATA: SqlState = SqlState(Cow::Borrowed("02000")); + + /// 02001 + pub const NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED: SqlState = SqlState(Cow::Borrowed("02001")); + + /// 03000 + pub const SQL_STATEMENT_NOT_YET_COMPLETE: SqlState = SqlState(Cow::Borrowed("03000")); + + /// 08000 + pub const CONNECTION_EXCEPTION: SqlState = SqlState(Cow::Borrowed("08000")); + + /// 08003 + pub const CONNECTION_DOES_NOT_EXIST: SqlState = SqlState(Cow::Borrowed("08003")); + + /// 08006 + pub const CONNECTION_FAILURE: SqlState = SqlState(Cow::Borrowed("08006")); + + /// 08001 + pub const SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION: SqlState = SqlState(Cow::Borrowed("08001")); + + /// 08004 + pub const SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION: SqlState = SqlState(Cow::Borrowed("08004")); + + /// 08007 + pub const TRANSACTION_RESOLUTION_UNKNOWN: SqlState = SqlState(Cow::Borrowed("08007")); + + /// 08P01 + pub const PROTOCOL_VIOLATION: SqlState = SqlState(Cow::Borrowed("08P01")); + + /// 09000 + pub const TRIGGERED_ACTION_EXCEPTION: SqlState = SqlState(Cow::Borrowed("09000")); + + /// 0A000 + pub const FEATURE_NOT_SUPPORTED: SqlState = SqlState(Cow::Borrowed("0A000")); + + /// 0B000 + pub const INVALID_TRANSACTION_INITIATION: SqlState = SqlState(Cow::Borrowed("0B000")); + + /// 0F000 + pub const LOCATOR_EXCEPTION: SqlState = SqlState(Cow::Borrowed("0F000")); + + /// 0F001 + pub const L_E_INVALID_SPECIFICATION: SqlState = SqlState(Cow::Borrowed("0F001")); + + /// 0L000 + pub const INVALID_GRANTOR: SqlState = SqlState(Cow::Borrowed("0L000")); + + /// 0LP01 + pub const INVALID_GRANT_OPERATION: SqlState = SqlState(Cow::Borrowed("0LP01")); + + /// 0P000 + pub const INVALID_ROLE_SPECIFICATION: SqlState = SqlState(Cow::Borrowed("0P000")); + + /// 0Z000 + pub const DIAGNOSTICS_EXCEPTION: SqlState = SqlState(Cow::Borrowed("0Z000")); + + /// 0Z002 + pub const STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER: SqlState = SqlState(Cow::Borrowed("0Z002")); + + /// 20000 + pub const CASE_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("20000")); + + /// 21000 + pub const CARDINALITY_VIOLATION: SqlState = SqlState(Cow::Borrowed("21000")); + + /// 22000 + pub const DATA_EXCEPTION: SqlState = SqlState(Cow::Borrowed("22000")); + + /// 2202E + pub const ARRAY_ELEMENT_ERROR: SqlState = SqlState(Cow::Borrowed("2202E")); + + /// 2202E + pub const ARRAY_SUBSCRIPT_ERROR: SqlState = SqlState(Cow::Borrowed("2202E")); + + /// 22021 + pub const CHARACTER_NOT_IN_REPERTOIRE: SqlState = SqlState(Cow::Borrowed("22021")); + + /// 22008 + pub const DATETIME_FIELD_OVERFLOW: SqlState = SqlState(Cow::Borrowed("22008")); + + /// 22008 + pub const DATETIME_VALUE_OUT_OF_RANGE: SqlState = SqlState(Cow::Borrowed("22008")); + + /// 22012 + pub const DIVISION_BY_ZERO: SqlState = SqlState(Cow::Borrowed("22012")); + + /// 22005 + pub const ERROR_IN_ASSIGNMENT: SqlState = SqlState(Cow::Borrowed("22005")); + + /// 2200B + pub const ESCAPE_CHARACTER_CONFLICT: SqlState = SqlState(Cow::Borrowed("2200B")); + + /// 22022 + pub const INDICATOR_OVERFLOW: SqlState = SqlState(Cow::Borrowed("22022")); + + /// 22015 + pub const INTERVAL_FIELD_OVERFLOW: SqlState = SqlState(Cow::Borrowed("22015")); + + /// 2201E + pub const INVALID_ARGUMENT_FOR_LOG: SqlState = SqlState(Cow::Borrowed("2201E")); + + /// 22014 + pub const INVALID_ARGUMENT_FOR_NTILE: SqlState = SqlState(Cow::Borrowed("22014")); + + /// 22016 + pub const INVALID_ARGUMENT_FOR_NTH_VALUE: SqlState = SqlState(Cow::Borrowed("22016")); + + /// 2201F + pub const INVALID_ARGUMENT_FOR_POWER_FUNCTION: SqlState = SqlState(Cow::Borrowed("2201F")); + + /// 2201G + pub const INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION: SqlState = SqlState(Cow::Borrowed("2201G")); + + /// 22018 + pub const INVALID_CHARACTER_VALUE_FOR_CAST: SqlState = SqlState(Cow::Borrowed("22018")); + + /// 22007 + pub const INVALID_DATETIME_FORMAT: SqlState = SqlState(Cow::Borrowed("22007")); + + /// 22019 + pub const INVALID_ESCAPE_CHARACTER: SqlState = SqlState(Cow::Borrowed("22019")); + + /// 2200D + pub const INVALID_ESCAPE_OCTET: SqlState = SqlState(Cow::Borrowed("2200D")); + + /// 22025 + pub const INVALID_ESCAPE_SEQUENCE: SqlState = SqlState(Cow::Borrowed("22025")); + + /// 22P06 + pub const NONSTANDARD_USE_OF_ESCAPE_CHARACTER: SqlState = SqlState(Cow::Borrowed("22P06")); + + /// 22010 + pub const INVALID_INDICATOR_PARAMETER_VALUE: SqlState = SqlState(Cow::Borrowed("22010")); + + /// 22023 + pub const INVALID_PARAMETER_VALUE: SqlState = SqlState(Cow::Borrowed("22023")); + + /// 2201B + pub const INVALID_REGULAR_EXPRESSION: SqlState = SqlState(Cow::Borrowed("2201B")); + + /// 2201W + pub const INVALID_ROW_COUNT_IN_LIMIT_CLAUSE: SqlState = SqlState(Cow::Borrowed("2201W")); + + /// 2201X + pub const INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE: SqlState = SqlState(Cow::Borrowed("2201X")); + + /// 2202H + pub const INVALID_TABLESAMPLE_ARGUMENT: SqlState = SqlState(Cow::Borrowed("2202H")); + + /// 2202G + pub const INVALID_TABLESAMPLE_REPEAT: SqlState = SqlState(Cow::Borrowed("2202G")); + + /// 22009 + pub const INVALID_TIME_ZONE_DISPLACEMENT_VALUE: SqlState = SqlState(Cow::Borrowed("22009")); + + /// 2200C + pub const INVALID_USE_OF_ESCAPE_CHARACTER: SqlState = SqlState(Cow::Borrowed("2200C")); + + /// 2200G + pub const MOST_SPECIFIC_TYPE_MISMATCH: SqlState = SqlState(Cow::Borrowed("2200G")); + + /// 22004 + pub const NULL_VALUE_NOT_ALLOWED: SqlState = SqlState(Cow::Borrowed("22004")); + + /// 22002 + pub const NULL_VALUE_NO_INDICATOR_PARAMETER: SqlState = SqlState(Cow::Borrowed("22002")); + + /// 22003 + pub const NUMERIC_VALUE_OUT_OF_RANGE: SqlState = SqlState(Cow::Borrowed("22003")); + + /// 2200H + pub const SEQUENCE_GENERATOR_LIMIT_EXCEEDED: SqlState = SqlState(Cow::Borrowed("2200H")); + + /// 22026 + pub const STRING_DATA_LENGTH_MISMATCH: SqlState = SqlState(Cow::Borrowed("22026")); + + /// 22001 + pub const STRING_DATA_RIGHT_TRUNCATION: SqlState = SqlState(Cow::Borrowed("22001")); + + /// 22011 + pub const SUBSTRING_ERROR: SqlState = SqlState(Cow::Borrowed("22011")); + + /// 22027 + pub const TRIM_ERROR: SqlState = SqlState(Cow::Borrowed("22027")); + + /// 22024 + pub const UNTERMINATED_C_STRING: SqlState = SqlState(Cow::Borrowed("22024")); + + /// 2200F + pub const ZERO_LENGTH_CHARACTER_STRING: SqlState = SqlState(Cow::Borrowed("2200F")); + + /// 22P01 + pub const FLOATING_POINT_EXCEPTION: SqlState = SqlState(Cow::Borrowed("22P01")); + + /// 22P02 + pub const INVALID_TEXT_REPRESENTATION: SqlState = SqlState(Cow::Borrowed("22P02")); + + /// 22P03 + pub const INVALID_BINARY_REPRESENTATION: SqlState = SqlState(Cow::Borrowed("22P03")); + + /// 22P04 + pub const BAD_COPY_FILE_FORMAT: SqlState = SqlState(Cow::Borrowed("22P04")); + + /// 22P05 + pub const UNTRANSLATABLE_CHARACTER: SqlState = SqlState(Cow::Borrowed("22P05")); + + /// 2200L + pub const NOT_AN_XML_DOCUMENT: SqlState = SqlState(Cow::Borrowed("2200L")); + + /// 2200M + pub const INVALID_XML_DOCUMENT: SqlState = SqlState(Cow::Borrowed("2200M")); + + /// 2200N + pub const INVALID_XML_CONTENT: SqlState = SqlState(Cow::Borrowed("2200N")); + + /// 2200S + pub const INVALID_XML_COMMENT: SqlState = SqlState(Cow::Borrowed("2200S")); + + /// 2200T + pub const INVALID_XML_PROCESSING_INSTRUCTION: SqlState = SqlState(Cow::Borrowed("2200T")); + + /// 23000 + pub const INTEGRITY_CONSTRAINT_VIOLATION: SqlState = SqlState(Cow::Borrowed("23000")); + + /// 23001 + pub const RESTRICT_VIOLATION: SqlState = SqlState(Cow::Borrowed("23001")); + + /// 23502 + pub const NOT_NULL_VIOLATION: SqlState = SqlState(Cow::Borrowed("23502")); + + /// 23503 + pub const FOREIGN_KEY_VIOLATION: SqlState = SqlState(Cow::Borrowed("23503")); + + /// 23505 + pub const UNIQUE_VIOLATION: SqlState = SqlState(Cow::Borrowed("23505")); + + /// 23514 + pub const CHECK_VIOLATION: SqlState = SqlState(Cow::Borrowed("23514")); + + /// 23P01 + pub const EXCLUSION_VIOLATION: SqlState = SqlState(Cow::Borrowed("23P01")); + + /// 24000 + pub const INVALID_CURSOR_STATE: SqlState = SqlState(Cow::Borrowed("24000")); + + /// 25000 + pub const INVALID_TRANSACTION_STATE: SqlState = SqlState(Cow::Borrowed("25000")); + + /// 25001 + pub const ACTIVE_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25001")); + + /// 25002 + pub const BRANCH_TRANSACTION_ALREADY_ACTIVE: SqlState = SqlState(Cow::Borrowed("25002")); + + /// 25008 + pub const HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL: SqlState = SqlState(Cow::Borrowed("25008")); + + /// 25003 + pub const INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25003")); + + /// 25004 + pub const INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25004")); + + /// 25005 + pub const NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25005")); + + /// 25006 + pub const READ_ONLY_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25006")); + + /// 25007 + pub const SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED: SqlState = SqlState(Cow::Borrowed("25007")); + + /// 25P01 + pub const NO_ACTIVE_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25P01")); + + /// 25P02 + pub const IN_FAILED_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25P02")); + + /// 25P03 + pub const IDLE_IN_TRANSACTION_SESSION_TIMEOUT: SqlState = SqlState(Cow::Borrowed("25P03")); + + /// 26000 + pub const INVALID_SQL_STATEMENT_NAME: SqlState = SqlState(Cow::Borrowed("26000")); + + /// 26000 + pub const UNDEFINED_PSTATEMENT: SqlState = SqlState(Cow::Borrowed("26000")); + + /// 27000 + pub const TRIGGERED_DATA_CHANGE_VIOLATION: SqlState = SqlState(Cow::Borrowed("27000")); + + /// 28000 + pub const INVALID_AUTHORIZATION_SPECIFICATION: SqlState = SqlState(Cow::Borrowed("28000")); + + /// 28P01 + pub const INVALID_PASSWORD: SqlState = SqlState(Cow::Borrowed("28P01")); + + /// 2B000 + pub const DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST: SqlState = SqlState(Cow::Borrowed("2B000")); + + /// 2BP01 + pub const DEPENDENT_OBJECTS_STILL_EXIST: SqlState = SqlState(Cow::Borrowed("2BP01")); + + /// 2D000 + pub const INVALID_TRANSACTION_TERMINATION: SqlState = SqlState(Cow::Borrowed("2D000")); + + /// 2F000 + pub const SQL_ROUTINE_EXCEPTION: SqlState = SqlState(Cow::Borrowed("2F000")); + + /// 2F005 + pub const S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT: SqlState = SqlState(Cow::Borrowed("2F005")); + + /// 2F002 + pub const S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("2F002")); + + /// 2F003 + pub const S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED: SqlState = SqlState(Cow::Borrowed("2F003")); + + /// 2F004 + pub const S_R_E_READING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("2F004")); + + /// 34000 + pub const INVALID_CURSOR_NAME: SqlState = SqlState(Cow::Borrowed("34000")); + + /// 34000 + pub const UNDEFINED_CURSOR: SqlState = SqlState(Cow::Borrowed("34000")); + + /// 38000 + pub const EXTERNAL_ROUTINE_EXCEPTION: SqlState = SqlState(Cow::Borrowed("38000")); + + /// 38001 + pub const E_R_E_CONTAINING_SQL_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("38001")); + + /// 38002 + pub const E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("38002")); + + /// 38003 + pub const E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED: SqlState = SqlState(Cow::Borrowed("38003")); + + /// 38004 + pub const E_R_E_READING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("38004")); + + /// 39000 + pub const EXTERNAL_ROUTINE_INVOCATION_EXCEPTION: SqlState = SqlState(Cow::Borrowed("39000")); + + /// 39001 + pub const E_R_I_E_INVALID_SQLSTATE_RETURNED: SqlState = SqlState(Cow::Borrowed("39001")); + + /// 39004 + pub const E_R_I_E_NULL_VALUE_NOT_ALLOWED: SqlState = SqlState(Cow::Borrowed("39004")); + + /// 39P01 + pub const E_R_I_E_TRIGGER_PROTOCOL_VIOLATED: SqlState = SqlState(Cow::Borrowed("39P01")); + + /// 39P02 + pub const E_R_I_E_SRF_PROTOCOL_VIOLATED: SqlState = SqlState(Cow::Borrowed("39P02")); + + /// 39P03 + pub const E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED: SqlState = SqlState(Cow::Borrowed("39P03")); + + /// 3B000 + pub const SAVEPOINT_EXCEPTION: SqlState = SqlState(Cow::Borrowed("3B000")); + + /// 3B001 + pub const S_E_INVALID_SPECIFICATION: SqlState = SqlState(Cow::Borrowed("3B001")); + + /// 3D000 + pub const INVALID_CATALOG_NAME: SqlState = SqlState(Cow::Borrowed("3D000")); + + /// 3D000 + pub const UNDEFINED_DATABASE: SqlState = SqlState(Cow::Borrowed("3D000")); + + /// 3F000 + pub const INVALID_SCHEMA_NAME: SqlState = SqlState(Cow::Borrowed("3F000")); + + /// 3F000 + pub const UNDEFINED_SCHEMA: SqlState = SqlState(Cow::Borrowed("3F000")); + + /// 40000 + pub const TRANSACTION_ROLLBACK: SqlState = SqlState(Cow::Borrowed("40000")); + + /// 40002 + pub const T_R_INTEGRITY_CONSTRAINT_VIOLATION: SqlState = SqlState(Cow::Borrowed("40002")); + + /// 40001 + pub const T_R_SERIALIZATION_FAILURE: SqlState = SqlState(Cow::Borrowed("40001")); + + /// 40003 + pub const T_R_STATEMENT_COMPLETION_UNKNOWN: SqlState = SqlState(Cow::Borrowed("40003")); + + /// 40P01 + pub const T_R_DEADLOCK_DETECTED: SqlState = SqlState(Cow::Borrowed("40P01")); + + /// 42000 + pub const SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION: SqlState = SqlState(Cow::Borrowed("42000")); + + /// 42601 + pub const SYNTAX_ERROR: SqlState = SqlState(Cow::Borrowed("42601")); + + /// 42501 + pub const INSUFFICIENT_PRIVILEGE: SqlState = SqlState(Cow::Borrowed("42501")); + + /// 42846 + pub const CANNOT_COERCE: SqlState = SqlState(Cow::Borrowed("42846")); + + /// 42803 + pub const GROUPING_ERROR: SqlState = SqlState(Cow::Borrowed("42803")); + + /// 42P20 + pub const WINDOWING_ERROR: SqlState = SqlState(Cow::Borrowed("42P20")); + + /// 42P19 + pub const INVALID_RECURSION: SqlState = SqlState(Cow::Borrowed("42P19")); + + /// 42830 + pub const INVALID_FOREIGN_KEY: SqlState = SqlState(Cow::Borrowed("42830")); + + /// 42602 + pub const INVALID_NAME: SqlState = SqlState(Cow::Borrowed("42602")); + + /// 42622 + pub const NAME_TOO_LONG: SqlState = SqlState(Cow::Borrowed("42622")); + + /// 42939 + pub const RESERVED_NAME: SqlState = SqlState(Cow::Borrowed("42939")); + + /// 42804 + pub const DATATYPE_MISMATCH: SqlState = SqlState(Cow::Borrowed("42804")); + + /// 42P18 + pub const INDETERMINATE_DATATYPE: SqlState = SqlState(Cow::Borrowed("42P18")); + + /// 42P21 + pub const COLLATION_MISMATCH: SqlState = SqlState(Cow::Borrowed("42P21")); + + /// 42P22 + pub const INDETERMINATE_COLLATION: SqlState = SqlState(Cow::Borrowed("42P22")); + + /// 42809 + pub const WRONG_OBJECT_TYPE: SqlState = SqlState(Cow::Borrowed("42809")); + + /// 428C9 + pub const GENERATED_ALWAYS: SqlState = SqlState(Cow::Borrowed("428C9")); + + /// 42703 + pub const UNDEFINED_COLUMN: SqlState = SqlState(Cow::Borrowed("42703")); + + /// 42883 + pub const UNDEFINED_FUNCTION: SqlState = SqlState(Cow::Borrowed("42883")); + + /// 42P01 + pub const UNDEFINED_TABLE: SqlState = SqlState(Cow::Borrowed("42P01")); + + /// 42P02 + pub const UNDEFINED_PARAMETER: SqlState = SqlState(Cow::Borrowed("42P02")); + + /// 42704 + pub const UNDEFINED_OBJECT: SqlState = SqlState(Cow::Borrowed("42704")); + + /// 42701 + pub const DUPLICATE_COLUMN: SqlState = SqlState(Cow::Borrowed("42701")); + + /// 42P03 + pub const DUPLICATE_CURSOR: SqlState = SqlState(Cow::Borrowed("42P03")); + + /// 42P04 + pub const DUPLICATE_DATABASE: SqlState = SqlState(Cow::Borrowed("42P04")); + + /// 42723 + pub const DUPLICATE_FUNCTION: SqlState = SqlState(Cow::Borrowed("42723")); + + /// 42P05 + pub const DUPLICATE_PSTATEMENT: SqlState = SqlState(Cow::Borrowed("42P05")); + + /// 42P06 + pub const DUPLICATE_SCHEMA: SqlState = SqlState(Cow::Borrowed("42P06")); + + /// 42P07 + pub const DUPLICATE_TABLE: SqlState = SqlState(Cow::Borrowed("42P07")); + + /// 42712 + pub const DUPLICATE_ALIAS: SqlState = SqlState(Cow::Borrowed("42712")); + + /// 42710 + pub const DUPLICATE_OBJECT: SqlState = SqlState(Cow::Borrowed("42710")); + + /// 42702 + pub const AMBIGUOUS_COLUMN: SqlState = SqlState(Cow::Borrowed("42702")); + + /// 42725 + pub const AMBIGUOUS_FUNCTION: SqlState = SqlState(Cow::Borrowed("42725")); + + /// 42P08 + pub const AMBIGUOUS_PARAMETER: SqlState = SqlState(Cow::Borrowed("42P08")); + + /// 42P09 + pub const AMBIGUOUS_ALIAS: SqlState = SqlState(Cow::Borrowed("42P09")); + + /// 42P10 + pub const INVALID_COLUMN_REFERENCE: SqlState = SqlState(Cow::Borrowed("42P10")); + + /// 42611 + pub const INVALID_COLUMN_DEFINITION: SqlState = SqlState(Cow::Borrowed("42611")); + + /// 42P11 + pub const INVALID_CURSOR_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P11")); + + /// 42P12 + pub const INVALID_DATABASE_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P12")); + + /// 42P13 + pub const INVALID_FUNCTION_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P13")); + + /// 42P14 + pub const INVALID_PSTATEMENT_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P14")); + + /// 42P15 + pub const INVALID_SCHEMA_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P15")); + + /// 42P16 + pub const INVALID_TABLE_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P16")); + + /// 42P17 + pub const INVALID_OBJECT_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P17")); + + /// 44000 + pub const WITH_CHECK_OPTION_VIOLATION: SqlState = SqlState(Cow::Borrowed("44000")); + + /// 53000 + pub const INSUFFICIENT_RESOURCES: SqlState = SqlState(Cow::Borrowed("53000")); + + /// 53100 + pub const DISK_FULL: SqlState = SqlState(Cow::Borrowed("53100")); + + /// 53200 + pub const OUT_OF_MEMORY: SqlState = SqlState(Cow::Borrowed("53200")); + + /// 53300 + pub const TOO_MANY_CONNECTIONS: SqlState = SqlState(Cow::Borrowed("53300")); + + /// 53400 + pub const CONFIGURATION_LIMIT_EXCEEDED: SqlState = SqlState(Cow::Borrowed("53400")); + + /// 54000 + pub const PROGRAM_LIMIT_EXCEEDED: SqlState = SqlState(Cow::Borrowed("54000")); + + /// 54001 + pub const STATEMENT_TOO_COMPLEX: SqlState = SqlState(Cow::Borrowed("54001")); + + /// 54011 + pub const TOO_MANY_COLUMNS: SqlState = SqlState(Cow::Borrowed("54011")); + + /// 54023 + pub const TOO_MANY_ARGUMENTS: SqlState = SqlState(Cow::Borrowed("54023")); + + /// 55000 + pub const OBJECT_NOT_IN_PREREQUISITE_STATE: SqlState = SqlState(Cow::Borrowed("55000")); + + /// 55006 + pub const OBJECT_IN_USE: SqlState = SqlState(Cow::Borrowed("55006")); + + /// 55P02 + pub const CANT_CHANGE_RUNTIME_PARAM: SqlState = SqlState(Cow::Borrowed("55P02")); + + /// 55P03 + pub const LOCK_NOT_AVAILABLE: SqlState = SqlState(Cow::Borrowed("55P03")); + + /// 55P04 + pub const UNSAFE_NEW_ENUM_VALUE_USAGE: SqlState = SqlState(Cow::Borrowed("55P04")); + + /// 57000 + pub const OPERATOR_INTERVENTION: SqlState = SqlState(Cow::Borrowed("57000")); + + /// 57014 + pub const QUERY_CANCELED: SqlState = SqlState(Cow::Borrowed("57014")); + + /// 57P01 + pub const ADMIN_SHUTDOWN: SqlState = SqlState(Cow::Borrowed("57P01")); + + /// 57P02 + pub const CRASH_SHUTDOWN: SqlState = SqlState(Cow::Borrowed("57P02")); + + /// 57P03 + pub const CANNOT_CONNECT_NOW: SqlState = SqlState(Cow::Borrowed("57P03")); + + /// 57P04 + pub const DATABASE_DROPPED: SqlState = SqlState(Cow::Borrowed("57P04")); + + /// 58000 + pub const SYSTEM_ERROR: SqlState = SqlState(Cow::Borrowed("58000")); + + /// 58030 + pub const IO_ERROR: SqlState = SqlState(Cow::Borrowed("58030")); + + /// 58P01 + pub const UNDEFINED_FILE: SqlState = SqlState(Cow::Borrowed("58P01")); + + /// 58P02 + pub const DUPLICATE_FILE: SqlState = SqlState(Cow::Borrowed("58P02")); + + /// 72000 + pub const SNAPSHOT_TOO_OLD: SqlState = SqlState(Cow::Borrowed("72000")); + + /// F0000 + pub const CONFIG_FILE_ERROR: SqlState = SqlState(Cow::Borrowed("F0000")); + + /// F0001 + pub const LOCK_FILE_EXISTS: SqlState = SqlState(Cow::Borrowed("F0001")); + + /// HV000 + pub const FDW_ERROR: SqlState = SqlState(Cow::Borrowed("HV000")); + + /// HV005 + pub const FDW_COLUMN_NAME_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("HV005")); + + /// HV002 + pub const FDW_DYNAMIC_PARAMETER_VALUE_NEEDED: SqlState = SqlState(Cow::Borrowed("HV002")); + + /// HV010 + pub const FDW_FUNCTION_SEQUENCE_ERROR: SqlState = SqlState(Cow::Borrowed("HV010")); + + /// HV021 + pub const FDW_INCONSISTENT_DESCRIPTOR_INFORMATION: SqlState = SqlState(Cow::Borrowed("HV021")); + + /// HV024 + pub const FDW_INVALID_ATTRIBUTE_VALUE: SqlState = SqlState(Cow::Borrowed("HV024")); + + /// HV007 + pub const FDW_INVALID_COLUMN_NAME: SqlState = SqlState(Cow::Borrowed("HV007")); + + /// HV008 + pub const FDW_INVALID_COLUMN_NUMBER: SqlState = SqlState(Cow::Borrowed("HV008")); + + /// HV004 + pub const FDW_INVALID_DATA_TYPE: SqlState = SqlState(Cow::Borrowed("HV004")); + + /// HV006 + pub const FDW_INVALID_DATA_TYPE_DESCRIPTORS: SqlState = SqlState(Cow::Borrowed("HV006")); + + /// HV091 + pub const FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER: SqlState = SqlState(Cow::Borrowed("HV091")); + + /// HV00B + pub const FDW_INVALID_HANDLE: SqlState = SqlState(Cow::Borrowed("HV00B")); + + /// HV00C + pub const FDW_INVALID_OPTION_INDEX: SqlState = SqlState(Cow::Borrowed("HV00C")); + + /// HV00D + pub const FDW_INVALID_OPTION_NAME: SqlState = SqlState(Cow::Borrowed("HV00D")); + + /// HV090 + pub const FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH: SqlState = SqlState(Cow::Borrowed("HV090")); + + /// HV00A + pub const FDW_INVALID_STRING_FORMAT: SqlState = SqlState(Cow::Borrowed("HV00A")); + + /// HV009 + pub const FDW_INVALID_USE_OF_NULL_POINTER: SqlState = SqlState(Cow::Borrowed("HV009")); + + /// HV014 + pub const FDW_TOO_MANY_HANDLES: SqlState = SqlState(Cow::Borrowed("HV014")); + + /// HV001 + pub const FDW_OUT_OF_MEMORY: SqlState = SqlState(Cow::Borrowed("HV001")); + + /// HV00P + pub const FDW_NO_SCHEMAS: SqlState = SqlState(Cow::Borrowed("HV00P")); + + /// HV00J + pub const FDW_OPTION_NAME_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("HV00J")); + + /// HV00K + pub const FDW_REPLY_HANDLE: SqlState = SqlState(Cow::Borrowed("HV00K")); + + /// HV00Q + pub const FDW_SCHEMA_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("HV00Q")); + + /// HV00R + pub const FDW_TABLE_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("HV00R")); + + /// HV00L + pub const FDW_UNABLE_TO_CREATE_EXECUTION: SqlState = SqlState(Cow::Borrowed("HV00L")); + + /// HV00M + pub const FDW_UNABLE_TO_CREATE_REPLY: SqlState = SqlState(Cow::Borrowed("HV00M")); + + /// HV00N + pub const FDW_UNABLE_TO_ESTABLISH_CONNECTION: SqlState = SqlState(Cow::Borrowed("HV00N")); + + /// P0000 + pub const PLPGSQL_ERROR: SqlState = SqlState(Cow::Borrowed("P0000")); + + /// P0001 + pub const RAISE_EXCEPTION: SqlState = SqlState(Cow::Borrowed("P0001")); + + /// P0002 + pub const NO_DATA_FOUND: SqlState = SqlState(Cow::Borrowed("P0002")); + + /// P0003 + pub const TOO_MANY_ROWS: SqlState = SqlState(Cow::Borrowed("P0003")); + + /// P0004 + pub const ASSERT_FAILURE: SqlState = SqlState(Cow::Borrowed("P0004")); + + /// XX000 + pub const INTERNAL_ERROR: SqlState = SqlState(Cow::Borrowed("XX000")); + + /// XX001 + pub const DATA_CORRUPTED: SqlState = SqlState(Cow::Borrowed("XX001")); + + /// XX002 + pub const INDEX_CORRUPTED: SqlState = SqlState(Cow::Borrowed("XX002")); } - -/// 00000 -pub const SUCCESSFUL_COMPLETION: SqlState = SqlState(Cow::Borrowed("00000")); - -/// 01000 -pub const WARNING: SqlState = SqlState(Cow::Borrowed("01000")); - -/// 0100C -pub const WARNING_DYNAMIC_RESULT_SETS_RETURNED: SqlState = SqlState(Cow::Borrowed("0100C")); - -/// 01008 -pub const WARNING_IMPLICIT_ZERO_BIT_PADDING: SqlState = SqlState(Cow::Borrowed("01008")); - -/// 01003 -pub const WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION: SqlState = SqlState(Cow::Borrowed("01003")); - -/// 01007 -pub const WARNING_PRIVILEGE_NOT_GRANTED: SqlState = SqlState(Cow::Borrowed("01007")); - -/// 01006 -pub const WARNING_PRIVILEGE_NOT_REVOKED: SqlState = SqlState(Cow::Borrowed("01006")); - -/// 01004 -pub const WARNING_STRING_DATA_RIGHT_TRUNCATION: SqlState = SqlState(Cow::Borrowed("01004")); - -/// 01P01 -pub const WARNING_DEPRECATED_FEATURE: SqlState = SqlState(Cow::Borrowed("01P01")); - -/// 02000 -pub const NO_DATA: SqlState = SqlState(Cow::Borrowed("02000")); - -/// 02001 -pub const NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED: SqlState = SqlState(Cow::Borrowed("02001")); - -/// 03000 -pub const SQL_STATEMENT_NOT_YET_COMPLETE: SqlState = SqlState(Cow::Borrowed("03000")); - -/// 08000 -pub const CONNECTION_EXCEPTION: SqlState = SqlState(Cow::Borrowed("08000")); - -/// 08003 -pub const CONNECTION_DOES_NOT_EXIST: SqlState = SqlState(Cow::Borrowed("08003")); - -/// 08006 -pub const CONNECTION_FAILURE: SqlState = SqlState(Cow::Borrowed("08006")); - -/// 08001 -pub const SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION: SqlState = SqlState(Cow::Borrowed("08001")); - -/// 08004 -pub const SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION: SqlState = SqlState(Cow::Borrowed("08004")); - -/// 08007 -pub const TRANSACTION_RESOLUTION_UNKNOWN: SqlState = SqlState(Cow::Borrowed("08007")); - -/// 08P01 -pub const PROTOCOL_VIOLATION: SqlState = SqlState(Cow::Borrowed("08P01")); - -/// 09000 -pub const TRIGGERED_ACTION_EXCEPTION: SqlState = SqlState(Cow::Borrowed("09000")); - -/// 0A000 -pub const FEATURE_NOT_SUPPORTED: SqlState = SqlState(Cow::Borrowed("0A000")); - -/// 0B000 -pub const INVALID_TRANSACTION_INITIATION: SqlState = SqlState(Cow::Borrowed("0B000")); - -/// 0F000 -pub const LOCATOR_EXCEPTION: SqlState = SqlState(Cow::Borrowed("0F000")); - -/// 0F001 -pub const L_E_INVALID_SPECIFICATION: SqlState = SqlState(Cow::Borrowed("0F001")); - -/// 0L000 -pub const INVALID_GRANTOR: SqlState = SqlState(Cow::Borrowed("0L000")); - -/// 0LP01 -pub const INVALID_GRANT_OPERATION: SqlState = SqlState(Cow::Borrowed("0LP01")); - -/// 0P000 -pub const INVALID_ROLE_SPECIFICATION: SqlState = SqlState(Cow::Borrowed("0P000")); - -/// 0Z000 -pub const DIAGNOSTICS_EXCEPTION: SqlState = SqlState(Cow::Borrowed("0Z000")); - -/// 0Z002 -pub const STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER: SqlState = SqlState(Cow::Borrowed("0Z002")); - -/// 20000 -pub const CASE_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("20000")); - -/// 21000 -pub const CARDINALITY_VIOLATION: SqlState = SqlState(Cow::Borrowed("21000")); - -/// 22000 -pub const DATA_EXCEPTION: SqlState = SqlState(Cow::Borrowed("22000")); - -/// 2202E -pub const ARRAY_ELEMENT_ERROR: SqlState = SqlState(Cow::Borrowed("2202E")); - -/// 2202E -pub const ARRAY_SUBSCRIPT_ERROR: SqlState = SqlState(Cow::Borrowed("2202E")); - -/// 22021 -pub const CHARACTER_NOT_IN_REPERTOIRE: SqlState = SqlState(Cow::Borrowed("22021")); - -/// 22008 -pub const DATETIME_FIELD_OVERFLOW: SqlState = SqlState(Cow::Borrowed("22008")); - -/// 22008 -pub const DATETIME_VALUE_OUT_OF_RANGE: SqlState = SqlState(Cow::Borrowed("22008")); - -/// 22012 -pub const DIVISION_BY_ZERO: SqlState = SqlState(Cow::Borrowed("22012")); - -/// 22005 -pub const ERROR_IN_ASSIGNMENT: SqlState = SqlState(Cow::Borrowed("22005")); - -/// 2200B -pub const ESCAPE_CHARACTER_CONFLICT: SqlState = SqlState(Cow::Borrowed("2200B")); - -/// 22022 -pub const INDICATOR_OVERFLOW: SqlState = SqlState(Cow::Borrowed("22022")); - -/// 22015 -pub const INTERVAL_FIELD_OVERFLOW: SqlState = SqlState(Cow::Borrowed("22015")); - -/// 2201E -pub const INVALID_ARGUMENT_FOR_LOG: SqlState = SqlState(Cow::Borrowed("2201E")); - -/// 22014 -pub const INVALID_ARGUMENT_FOR_NTILE: SqlState = SqlState(Cow::Borrowed("22014")); - -/// 22016 -pub const INVALID_ARGUMENT_FOR_NTH_VALUE: SqlState = SqlState(Cow::Borrowed("22016")); - -/// 2201F -pub const INVALID_ARGUMENT_FOR_POWER_FUNCTION: SqlState = SqlState(Cow::Borrowed("2201F")); - -/// 2201G -pub const INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION: SqlState = SqlState(Cow::Borrowed("2201G")); - -/// 22018 -pub const INVALID_CHARACTER_VALUE_FOR_CAST: SqlState = SqlState(Cow::Borrowed("22018")); - -/// 22007 -pub const INVALID_DATETIME_FORMAT: SqlState = SqlState(Cow::Borrowed("22007")); - -/// 22019 -pub const INVALID_ESCAPE_CHARACTER: SqlState = SqlState(Cow::Borrowed("22019")); - -/// 2200D -pub const INVALID_ESCAPE_OCTET: SqlState = SqlState(Cow::Borrowed("2200D")); - -/// 22025 -pub const INVALID_ESCAPE_SEQUENCE: SqlState = SqlState(Cow::Borrowed("22025")); - -/// 22P06 -pub const NONSTANDARD_USE_OF_ESCAPE_CHARACTER: SqlState = SqlState(Cow::Borrowed("22P06")); - -/// 22010 -pub const INVALID_INDICATOR_PARAMETER_VALUE: SqlState = SqlState(Cow::Borrowed("22010")); - -/// 22023 -pub const INVALID_PARAMETER_VALUE: SqlState = SqlState(Cow::Borrowed("22023")); - -/// 2201B -pub const INVALID_REGULAR_EXPRESSION: SqlState = SqlState(Cow::Borrowed("2201B")); - -/// 2201W -pub const INVALID_ROW_COUNT_IN_LIMIT_CLAUSE: SqlState = SqlState(Cow::Borrowed("2201W")); - -/// 2201X -pub const INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE: SqlState = SqlState(Cow::Borrowed("2201X")); - -/// 2202H -pub const INVALID_TABLESAMPLE_ARGUMENT: SqlState = SqlState(Cow::Borrowed("2202H")); - -/// 2202G -pub const INVALID_TABLESAMPLE_REPEAT: SqlState = SqlState(Cow::Borrowed("2202G")); - -/// 22009 -pub const INVALID_TIME_ZONE_DISPLACEMENT_VALUE: SqlState = SqlState(Cow::Borrowed("22009")); - -/// 2200C -pub const INVALID_USE_OF_ESCAPE_CHARACTER: SqlState = SqlState(Cow::Borrowed("2200C")); - -/// 2200G -pub const MOST_SPECIFIC_TYPE_MISMATCH: SqlState = SqlState(Cow::Borrowed("2200G")); - -/// 22004 -pub const NULL_VALUE_NOT_ALLOWED: SqlState = SqlState(Cow::Borrowed("22004")); - -/// 22002 -pub const NULL_VALUE_NO_INDICATOR_PARAMETER: SqlState = SqlState(Cow::Borrowed("22002")); - -/// 22003 -pub const NUMERIC_VALUE_OUT_OF_RANGE: SqlState = SqlState(Cow::Borrowed("22003")); - -/// 2200H -pub const SEQUENCE_GENERATOR_LIMIT_EXCEEDED: SqlState = SqlState(Cow::Borrowed("2200H")); - -/// 22026 -pub const STRING_DATA_LENGTH_MISMATCH: SqlState = SqlState(Cow::Borrowed("22026")); - -/// 22001 -pub const STRING_DATA_RIGHT_TRUNCATION: SqlState = SqlState(Cow::Borrowed("22001")); - -/// 22011 -pub const SUBSTRING_ERROR: SqlState = SqlState(Cow::Borrowed("22011")); - -/// 22027 -pub const TRIM_ERROR: SqlState = SqlState(Cow::Borrowed("22027")); - -/// 22024 -pub const UNTERMINATED_C_STRING: SqlState = SqlState(Cow::Borrowed("22024")); - -/// 2200F -pub const ZERO_LENGTH_CHARACTER_STRING: SqlState = SqlState(Cow::Borrowed("2200F")); - -/// 22P01 -pub const FLOATING_POINT_EXCEPTION: SqlState = SqlState(Cow::Borrowed("22P01")); - -/// 22P02 -pub const INVALID_TEXT_REPRESENTATION: SqlState = SqlState(Cow::Borrowed("22P02")); - -/// 22P03 -pub const INVALID_BINARY_REPRESENTATION: SqlState = SqlState(Cow::Borrowed("22P03")); - -/// 22P04 -pub const BAD_COPY_FILE_FORMAT: SqlState = SqlState(Cow::Borrowed("22P04")); - -/// 22P05 -pub const UNTRANSLATABLE_CHARACTER: SqlState = SqlState(Cow::Borrowed("22P05")); - -/// 2200L -pub const NOT_AN_XML_DOCUMENT: SqlState = SqlState(Cow::Borrowed("2200L")); - -/// 2200M -pub const INVALID_XML_DOCUMENT: SqlState = SqlState(Cow::Borrowed("2200M")); - -/// 2200N -pub const INVALID_XML_CONTENT: SqlState = SqlState(Cow::Borrowed("2200N")); - -/// 2200S -pub const INVALID_XML_COMMENT: SqlState = SqlState(Cow::Borrowed("2200S")); - -/// 2200T -pub const INVALID_XML_PROCESSING_INSTRUCTION: SqlState = SqlState(Cow::Borrowed("2200T")); - -/// 23000 -pub const INTEGRITY_CONSTRAINT_VIOLATION: SqlState = SqlState(Cow::Borrowed("23000")); - -/// 23001 -pub const RESTRICT_VIOLATION: SqlState = SqlState(Cow::Borrowed("23001")); - -/// 23502 -pub const NOT_NULL_VIOLATION: SqlState = SqlState(Cow::Borrowed("23502")); - -/// 23503 -pub const FOREIGN_KEY_VIOLATION: SqlState = SqlState(Cow::Borrowed("23503")); - -/// 23505 -pub const UNIQUE_VIOLATION: SqlState = SqlState(Cow::Borrowed("23505")); - -/// 23514 -pub const CHECK_VIOLATION: SqlState = SqlState(Cow::Borrowed("23514")); - -/// 23P01 -pub const EXCLUSION_VIOLATION: SqlState = SqlState(Cow::Borrowed("23P01")); - -/// 24000 -pub const INVALID_CURSOR_STATE: SqlState = SqlState(Cow::Borrowed("24000")); - -/// 25000 -pub const INVALID_TRANSACTION_STATE: SqlState = SqlState(Cow::Borrowed("25000")); - -/// 25001 -pub const ACTIVE_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25001")); - -/// 25002 -pub const BRANCH_TRANSACTION_ALREADY_ACTIVE: SqlState = SqlState(Cow::Borrowed("25002")); - -/// 25008 -pub const HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL: SqlState = SqlState(Cow::Borrowed("25008")); - -/// 25003 -pub const INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25003")); - -/// 25004 -pub const INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25004")); - -/// 25005 -pub const NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25005")); - -/// 25006 -pub const READ_ONLY_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25006")); - -/// 25007 -pub const SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED: SqlState = SqlState(Cow::Borrowed("25007")); - -/// 25P01 -pub const NO_ACTIVE_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25P01")); - -/// 25P02 -pub const IN_FAILED_SQL_TRANSACTION: SqlState = SqlState(Cow::Borrowed("25P02")); - -/// 25P03 -pub const IDLE_IN_TRANSACTION_SESSION_TIMEOUT: SqlState = SqlState(Cow::Borrowed("25P03")); - -/// 26000 -pub const INVALID_SQL_STATEMENT_NAME: SqlState = SqlState(Cow::Borrowed("26000")); - -/// 26000 -pub const UNDEFINED_PSTATEMENT: SqlState = SqlState(Cow::Borrowed("26000")); - -/// 27000 -pub const TRIGGERED_DATA_CHANGE_VIOLATION: SqlState = SqlState(Cow::Borrowed("27000")); - -/// 28000 -pub const INVALID_AUTHORIZATION_SPECIFICATION: SqlState = SqlState(Cow::Borrowed("28000")); - -/// 28P01 -pub const INVALID_PASSWORD: SqlState = SqlState(Cow::Borrowed("28P01")); - -/// 2B000 -pub const DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST: SqlState = SqlState(Cow::Borrowed("2B000")); - -/// 2BP01 -pub const DEPENDENT_OBJECTS_STILL_EXIST: SqlState = SqlState(Cow::Borrowed("2BP01")); - -/// 2D000 -pub const INVALID_TRANSACTION_TERMINATION: SqlState = SqlState(Cow::Borrowed("2D000")); - -/// 2F000 -pub const SQL_ROUTINE_EXCEPTION: SqlState = SqlState(Cow::Borrowed("2F000")); - -/// 2F005 -pub const S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT: SqlState = SqlState(Cow::Borrowed("2F005")); - -/// 2F002 -pub const S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("2F002")); - -/// 2F003 -pub const S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED: SqlState = SqlState(Cow::Borrowed("2F003")); - -/// 2F004 -pub const S_R_E_READING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("2F004")); - -/// 34000 -pub const INVALID_CURSOR_NAME: SqlState = SqlState(Cow::Borrowed("34000")); - -/// 34000 -pub const UNDEFINED_CURSOR: SqlState = SqlState(Cow::Borrowed("34000")); - -/// 38000 -pub const EXTERNAL_ROUTINE_EXCEPTION: SqlState = SqlState(Cow::Borrowed("38000")); - -/// 38001 -pub const E_R_E_CONTAINING_SQL_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("38001")); - -/// 38002 -pub const E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("38002")); - -/// 38003 -pub const E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED: SqlState = SqlState(Cow::Borrowed("38003")); - -/// 38004 -pub const E_R_E_READING_SQL_DATA_NOT_PERMITTED: SqlState = SqlState(Cow::Borrowed("38004")); - -/// 39000 -pub const EXTERNAL_ROUTINE_INVOCATION_EXCEPTION: SqlState = SqlState(Cow::Borrowed("39000")); - -/// 39001 -pub const E_R_I_E_INVALID_SQLSTATE_RETURNED: SqlState = SqlState(Cow::Borrowed("39001")); - -/// 39004 -pub const E_R_I_E_NULL_VALUE_NOT_ALLOWED: SqlState = SqlState(Cow::Borrowed("39004")); - -/// 39P01 -pub const E_R_I_E_TRIGGER_PROTOCOL_VIOLATED: SqlState = SqlState(Cow::Borrowed("39P01")); - -/// 39P02 -pub const E_R_I_E_SRF_PROTOCOL_VIOLATED: SqlState = SqlState(Cow::Borrowed("39P02")); - -/// 39P03 -pub const E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED: SqlState = SqlState(Cow::Borrowed("39P03")); - -/// 3B000 -pub const SAVEPOINT_EXCEPTION: SqlState = SqlState(Cow::Borrowed("3B000")); - -/// 3B001 -pub const S_E_INVALID_SPECIFICATION: SqlState = SqlState(Cow::Borrowed("3B001")); - -/// 3D000 -pub const INVALID_CATALOG_NAME: SqlState = SqlState(Cow::Borrowed("3D000")); - -/// 3D000 -pub const UNDEFINED_DATABASE: SqlState = SqlState(Cow::Borrowed("3D000")); - -/// 3F000 -pub const INVALID_SCHEMA_NAME: SqlState = SqlState(Cow::Borrowed("3F000")); - -/// 3F000 -pub const UNDEFINED_SCHEMA: SqlState = SqlState(Cow::Borrowed("3F000")); - -/// 40000 -pub const TRANSACTION_ROLLBACK: SqlState = SqlState(Cow::Borrowed("40000")); - -/// 40002 -pub const T_R_INTEGRITY_CONSTRAINT_VIOLATION: SqlState = SqlState(Cow::Borrowed("40002")); - -/// 40001 -pub const T_R_SERIALIZATION_FAILURE: SqlState = SqlState(Cow::Borrowed("40001")); - -/// 40003 -pub const T_R_STATEMENT_COMPLETION_UNKNOWN: SqlState = SqlState(Cow::Borrowed("40003")); - -/// 40P01 -pub const T_R_DEADLOCK_DETECTED: SqlState = SqlState(Cow::Borrowed("40P01")); - -/// 42000 -pub const SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION: SqlState = SqlState(Cow::Borrowed("42000")); - -/// 42601 -pub const SYNTAX_ERROR: SqlState = SqlState(Cow::Borrowed("42601")); - -/// 42501 -pub const INSUFFICIENT_PRIVILEGE: SqlState = SqlState(Cow::Borrowed("42501")); - -/// 42846 -pub const CANNOT_COERCE: SqlState = SqlState(Cow::Borrowed("42846")); - -/// 42803 -pub const GROUPING_ERROR: SqlState = SqlState(Cow::Borrowed("42803")); - -/// 42P20 -pub const WINDOWING_ERROR: SqlState = SqlState(Cow::Borrowed("42P20")); - -/// 42P19 -pub const INVALID_RECURSION: SqlState = SqlState(Cow::Borrowed("42P19")); - -/// 42830 -pub const INVALID_FOREIGN_KEY: SqlState = SqlState(Cow::Borrowed("42830")); - -/// 42602 -pub const INVALID_NAME: SqlState = SqlState(Cow::Borrowed("42602")); - -/// 42622 -pub const NAME_TOO_LONG: SqlState = SqlState(Cow::Borrowed("42622")); - -/// 42939 -pub const RESERVED_NAME: SqlState = SqlState(Cow::Borrowed("42939")); - -/// 42804 -pub const DATATYPE_MISMATCH: SqlState = SqlState(Cow::Borrowed("42804")); - -/// 42P18 -pub const INDETERMINATE_DATATYPE: SqlState = SqlState(Cow::Borrowed("42P18")); - -/// 42P21 -pub const COLLATION_MISMATCH: SqlState = SqlState(Cow::Borrowed("42P21")); - -/// 42P22 -pub const INDETERMINATE_COLLATION: SqlState = SqlState(Cow::Borrowed("42P22")); - -/// 42809 -pub const WRONG_OBJECT_TYPE: SqlState = SqlState(Cow::Borrowed("42809")); - -/// 428C9 -pub const GENERATED_ALWAYS: SqlState = SqlState(Cow::Borrowed("428C9")); - -/// 42703 -pub const UNDEFINED_COLUMN: SqlState = SqlState(Cow::Borrowed("42703")); - -/// 42883 -pub const UNDEFINED_FUNCTION: SqlState = SqlState(Cow::Borrowed("42883")); - -/// 42P01 -pub const UNDEFINED_TABLE: SqlState = SqlState(Cow::Borrowed("42P01")); - -/// 42P02 -pub const UNDEFINED_PARAMETER: SqlState = SqlState(Cow::Borrowed("42P02")); - -/// 42704 -pub const UNDEFINED_OBJECT: SqlState = SqlState(Cow::Borrowed("42704")); - -/// 42701 -pub const DUPLICATE_COLUMN: SqlState = SqlState(Cow::Borrowed("42701")); - -/// 42P03 -pub const DUPLICATE_CURSOR: SqlState = SqlState(Cow::Borrowed("42P03")); - -/// 42P04 -pub const DUPLICATE_DATABASE: SqlState = SqlState(Cow::Borrowed("42P04")); - -/// 42723 -pub const DUPLICATE_FUNCTION: SqlState = SqlState(Cow::Borrowed("42723")); - -/// 42P05 -pub const DUPLICATE_PSTATEMENT: SqlState = SqlState(Cow::Borrowed("42P05")); - -/// 42P06 -pub const DUPLICATE_SCHEMA: SqlState = SqlState(Cow::Borrowed("42P06")); - -/// 42P07 -pub const DUPLICATE_TABLE: SqlState = SqlState(Cow::Borrowed("42P07")); - -/// 42712 -pub const DUPLICATE_ALIAS: SqlState = SqlState(Cow::Borrowed("42712")); - -/// 42710 -pub const DUPLICATE_OBJECT: SqlState = SqlState(Cow::Borrowed("42710")); - -/// 42702 -pub const AMBIGUOUS_COLUMN: SqlState = SqlState(Cow::Borrowed("42702")); - -/// 42725 -pub const AMBIGUOUS_FUNCTION: SqlState = SqlState(Cow::Borrowed("42725")); - -/// 42P08 -pub const AMBIGUOUS_PARAMETER: SqlState = SqlState(Cow::Borrowed("42P08")); - -/// 42P09 -pub const AMBIGUOUS_ALIAS: SqlState = SqlState(Cow::Borrowed("42P09")); - -/// 42P10 -pub const INVALID_COLUMN_REFERENCE: SqlState = SqlState(Cow::Borrowed("42P10")); - -/// 42611 -pub const INVALID_COLUMN_DEFINITION: SqlState = SqlState(Cow::Borrowed("42611")); - -/// 42P11 -pub const INVALID_CURSOR_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P11")); - -/// 42P12 -pub const INVALID_DATABASE_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P12")); - -/// 42P13 -pub const INVALID_FUNCTION_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P13")); - -/// 42P14 -pub const INVALID_PSTATEMENT_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P14")); - -/// 42P15 -pub const INVALID_SCHEMA_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P15")); - -/// 42P16 -pub const INVALID_TABLE_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P16")); - -/// 42P17 -pub const INVALID_OBJECT_DEFINITION: SqlState = SqlState(Cow::Borrowed("42P17")); - -/// 44000 -pub const WITH_CHECK_OPTION_VIOLATION: SqlState = SqlState(Cow::Borrowed("44000")); - -/// 53000 -pub const INSUFFICIENT_RESOURCES: SqlState = SqlState(Cow::Borrowed("53000")); - -/// 53100 -pub const DISK_FULL: SqlState = SqlState(Cow::Borrowed("53100")); - -/// 53200 -pub const OUT_OF_MEMORY: SqlState = SqlState(Cow::Borrowed("53200")); - -/// 53300 -pub const TOO_MANY_CONNECTIONS: SqlState = SqlState(Cow::Borrowed("53300")); - -/// 53400 -pub const CONFIGURATION_LIMIT_EXCEEDED: SqlState = SqlState(Cow::Borrowed("53400")); - -/// 54000 -pub const PROGRAM_LIMIT_EXCEEDED: SqlState = SqlState(Cow::Borrowed("54000")); - -/// 54001 -pub const STATEMENT_TOO_COMPLEX: SqlState = SqlState(Cow::Borrowed("54001")); - -/// 54011 -pub const TOO_MANY_COLUMNS: SqlState = SqlState(Cow::Borrowed("54011")); - -/// 54023 -pub const TOO_MANY_ARGUMENTS: SqlState = SqlState(Cow::Borrowed("54023")); - -/// 55000 -pub const OBJECT_NOT_IN_PREREQUISITE_STATE: SqlState = SqlState(Cow::Borrowed("55000")); - -/// 55006 -pub const OBJECT_IN_USE: SqlState = SqlState(Cow::Borrowed("55006")); - -/// 55P02 -pub const CANT_CHANGE_RUNTIME_PARAM: SqlState = SqlState(Cow::Borrowed("55P02")); - -/// 55P03 -pub const LOCK_NOT_AVAILABLE: SqlState = SqlState(Cow::Borrowed("55P03")); - -/// 55P04 -pub const UNSAFE_NEW_ENUM_VALUE_USAGE: SqlState = SqlState(Cow::Borrowed("55P04")); - -/// 57000 -pub const OPERATOR_INTERVENTION: SqlState = SqlState(Cow::Borrowed("57000")); - -/// 57014 -pub const QUERY_CANCELED: SqlState = SqlState(Cow::Borrowed("57014")); - -/// 57P01 -pub const ADMIN_SHUTDOWN: SqlState = SqlState(Cow::Borrowed("57P01")); - -/// 57P02 -pub const CRASH_SHUTDOWN: SqlState = SqlState(Cow::Borrowed("57P02")); - -/// 57P03 -pub const CANNOT_CONNECT_NOW: SqlState = SqlState(Cow::Borrowed("57P03")); - -/// 57P04 -pub const DATABASE_DROPPED: SqlState = SqlState(Cow::Borrowed("57P04")); - -/// 58000 -pub const SYSTEM_ERROR: SqlState = SqlState(Cow::Borrowed("58000")); - -/// 58030 -pub const IO_ERROR: SqlState = SqlState(Cow::Borrowed("58030")); - -/// 58P01 -pub const UNDEFINED_FILE: SqlState = SqlState(Cow::Borrowed("58P01")); - -/// 58P02 -pub const DUPLICATE_FILE: SqlState = SqlState(Cow::Borrowed("58P02")); - -/// 72000 -pub const SNAPSHOT_TOO_OLD: SqlState = SqlState(Cow::Borrowed("72000")); - -/// F0000 -pub const CONFIG_FILE_ERROR: SqlState = SqlState(Cow::Borrowed("F0000")); - -/// F0001 -pub const LOCK_FILE_EXISTS: SqlState = SqlState(Cow::Borrowed("F0001")); - -/// HV000 -pub const FDW_ERROR: SqlState = SqlState(Cow::Borrowed("HV000")); - -/// HV005 -pub const FDW_COLUMN_NAME_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("HV005")); - -/// HV002 -pub const FDW_DYNAMIC_PARAMETER_VALUE_NEEDED: SqlState = SqlState(Cow::Borrowed("HV002")); - -/// HV010 -pub const FDW_FUNCTION_SEQUENCE_ERROR: SqlState = SqlState(Cow::Borrowed("HV010")); - -/// HV021 -pub const FDW_INCONSISTENT_DESCRIPTOR_INFORMATION: SqlState = SqlState(Cow::Borrowed("HV021")); - -/// HV024 -pub const FDW_INVALID_ATTRIBUTE_VALUE: SqlState = SqlState(Cow::Borrowed("HV024")); - -/// HV007 -pub const FDW_INVALID_COLUMN_NAME: SqlState = SqlState(Cow::Borrowed("HV007")); - -/// HV008 -pub const FDW_INVALID_COLUMN_NUMBER: SqlState = SqlState(Cow::Borrowed("HV008")); - -/// HV004 -pub const FDW_INVALID_DATA_TYPE: SqlState = SqlState(Cow::Borrowed("HV004")); - -/// HV006 -pub const FDW_INVALID_DATA_TYPE_DESCRIPTORS: SqlState = SqlState(Cow::Borrowed("HV006")); - -/// HV091 -pub const FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER: SqlState = SqlState(Cow::Borrowed("HV091")); - -/// HV00B -pub const FDW_INVALID_HANDLE: SqlState = SqlState(Cow::Borrowed("HV00B")); - -/// HV00C -pub const FDW_INVALID_OPTION_INDEX: SqlState = SqlState(Cow::Borrowed("HV00C")); - -/// HV00D -pub const FDW_INVALID_OPTION_NAME: SqlState = SqlState(Cow::Borrowed("HV00D")); - -/// HV090 -pub const FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH: SqlState = SqlState(Cow::Borrowed("HV090")); - -/// HV00A -pub const FDW_INVALID_STRING_FORMAT: SqlState = SqlState(Cow::Borrowed("HV00A")); - -/// HV009 -pub const FDW_INVALID_USE_OF_NULL_POINTER: SqlState = SqlState(Cow::Borrowed("HV009")); - -/// HV014 -pub const FDW_TOO_MANY_HANDLES: SqlState = SqlState(Cow::Borrowed("HV014")); - -/// HV001 -pub const FDW_OUT_OF_MEMORY: SqlState = SqlState(Cow::Borrowed("HV001")); - -/// HV00P -pub const FDW_NO_SCHEMAS: SqlState = SqlState(Cow::Borrowed("HV00P")); - -/// HV00J -pub const FDW_OPTION_NAME_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("HV00J")); - -/// HV00K -pub const FDW_REPLY_HANDLE: SqlState = SqlState(Cow::Borrowed("HV00K")); - -/// HV00Q -pub const FDW_SCHEMA_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("HV00Q")); - -/// HV00R -pub const FDW_TABLE_NOT_FOUND: SqlState = SqlState(Cow::Borrowed("HV00R")); - -/// HV00L -pub const FDW_UNABLE_TO_CREATE_EXECUTION: SqlState = SqlState(Cow::Borrowed("HV00L")); - -/// HV00M -pub const FDW_UNABLE_TO_CREATE_REPLY: SqlState = SqlState(Cow::Borrowed("HV00M")); - -/// HV00N -pub const FDW_UNABLE_TO_ESTABLISH_CONNECTION: SqlState = SqlState(Cow::Borrowed("HV00N")); - -/// P0000 -pub const PLPGSQL_ERROR: SqlState = SqlState(Cow::Borrowed("P0000")); - -/// P0001 -pub const RAISE_EXCEPTION: SqlState = SqlState(Cow::Borrowed("P0001")); - -/// P0002 -pub const NO_DATA_FOUND: SqlState = SqlState(Cow::Borrowed("P0002")); - -/// P0003 -pub const TOO_MANY_ROWS: SqlState = SqlState(Cow::Borrowed("P0003")); - -/// P0004 -pub const ASSERT_FAILURE: SqlState = SqlState(Cow::Borrowed("P0004")); - -/// XX000 -pub const INTERNAL_ERROR: SqlState = SqlState(Cow::Borrowed("XX000")); - -/// XX001 -pub const DATA_CORRUPTED: SqlState = SqlState(Cow::Borrowed("XX001")); - -/// XX002 -pub const INDEX_CORRUPTED: SqlState = SqlState(Cow::Borrowed("XX002")); - #[cfg_attr(rustfmt, rustfmt_skip)] static SQLSTATE_MAP: phf::Map<&'static str, SqlState> = ::phf::Map { key: 1897749892740154578, @@ -817,246 +816,246 @@ static SQLSTATE_MAP: phf::Map<&'static str, SqlState> = ::phf::Map { (1, 94), ]), entries: ::phf::Slice::Static(&[ - ("23001", RESTRICT_VIOLATION), - ("42830", INVALID_FOREIGN_KEY), - ("P0000", PLPGSQL_ERROR), - ("58000", SYSTEM_ERROR), - ("57P01", ADMIN_SHUTDOWN), - ("22P04", BAD_COPY_FILE_FORMAT), - ("42P05", DUPLICATE_PSTATEMENT), - ("28000", INVALID_AUTHORIZATION_SPECIFICATION), - ("2202E", ARRAY_ELEMENT_ERROR), - ("2F005", S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT), - ("53400", CONFIGURATION_LIMIT_EXCEEDED), - ("20000", CASE_NOT_FOUND), - ("25004", INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION), - ("09000", TRIGGERED_ACTION_EXCEPTION), - ("42P10", INVALID_COLUMN_REFERENCE), - ("39P03", E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED), - ("08000", CONNECTION_EXCEPTION), - ("08006", CONNECTION_FAILURE), - ("2201W", INVALID_ROW_COUNT_IN_LIMIT_CLAUSE), - ("03000", SQL_STATEMENT_NOT_YET_COMPLETE), - ("22014", INVALID_ARGUMENT_FOR_NTILE), - ("42611", INVALID_COLUMN_DEFINITION), - ("42P11", INVALID_CURSOR_DEFINITION), - ("2200N", INVALID_XML_CONTENT), - ("57014", QUERY_CANCELED), - ("01003", WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION), - ("01000", WARNING), - ("55P04", UNSAFE_NEW_ENUM_VALUE_USAGE), - ("25003", INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION), - ("2200L", NOT_AN_XML_DOCUMENT), - ("42846", CANNOT_COERCE), - ("55P03", LOCK_NOT_AVAILABLE), - ("08007", TRANSACTION_RESOLUTION_UNKNOWN), - ("XX000", INTERNAL_ERROR), - ("22005", ERROR_IN_ASSIGNMENT), - ("22P03", INVALID_BINARY_REPRESENTATION), - ("2201X", INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE), - ("54011", TOO_MANY_COLUMNS), - ("HV008", FDW_INVALID_COLUMN_NUMBER), - ("HV009", FDW_INVALID_USE_OF_NULL_POINTER), - ("0LP01", INVALID_GRANT_OPERATION), - ("42704", UNDEFINED_OBJECT), - ("25005", NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION), - ("25P03", IDLE_IN_TRANSACTION_SESSION_TIMEOUT), - ("44000", WITH_CHECK_OPTION_VIOLATION), - ("22024", UNTERMINATED_C_STRING), - ("0L000", INVALID_GRANTOR), - ("40000", TRANSACTION_ROLLBACK), - ("42P08", AMBIGUOUS_PARAMETER), - ("38000", EXTERNAL_ROUTINE_EXCEPTION), - ("42939", RESERVED_NAME), - ("40001", T_R_SERIALIZATION_FAILURE), - ("HV00K", FDW_REPLY_HANDLE), - ("2F002", S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED), - ("HV001", FDW_OUT_OF_MEMORY), - ("42P19", INVALID_RECURSION), - ("HV002", FDW_DYNAMIC_PARAMETER_VALUE_NEEDED), - ("0A000", FEATURE_NOT_SUPPORTED), - ("58P02", DUPLICATE_FILE), - ("25006", READ_ONLY_SQL_TRANSACTION), - ("22009", INVALID_TIME_ZONE_DISPLACEMENT_VALUE), - ("0F001", L_E_INVALID_SPECIFICATION), - ("P0002", NO_DATA_FOUND), - ("2F000", SQL_ROUTINE_EXCEPTION), - ("01006", WARNING_PRIVILEGE_NOT_REVOKED), - ("22025", INVALID_ESCAPE_SEQUENCE), - ("22027", TRIM_ERROR), - ("54001", STATEMENT_TOO_COMPLEX), - ("42602", INVALID_NAME), - ("54023", TOO_MANY_ARGUMENTS), - ("2200T", INVALID_XML_PROCESSING_INSTRUCTION), - ("01007", WARNING_PRIVILEGE_NOT_GRANTED), - ("22000", DATA_EXCEPTION), - ("28P01", INVALID_PASSWORD), - ("23514", CHECK_VIOLATION), - ("39P02", E_R_I_E_SRF_PROTOCOL_VIOLATED), - ("57P02", CRASH_SHUTDOWN), - ("42P03", DUPLICATE_CURSOR), - ("22021", CHARACTER_NOT_IN_REPERTOIRE), - ("HV00P", FDW_NO_SCHEMAS), - ("42701", DUPLICATE_COLUMN), - ("42P15", INVALID_SCHEMA_DEFINITION), - ("HV00B", FDW_INVALID_HANDLE), - ("34000", INVALID_CURSOR_NAME), - ("22P06", NONSTANDARD_USE_OF_ESCAPE_CHARACTER), - ("P0001", RAISE_EXCEPTION), - ("08P01", PROTOCOL_VIOLATION), - ("42723", DUPLICATE_FUNCTION), - ("08001", SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), - ("HV006", FDW_INVALID_DATA_TYPE_DESCRIPTORS), - ("23000", INTEGRITY_CONSTRAINT_VIOLATION), - ("42712", DUPLICATE_ALIAS), - ("2201G", INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION), - ("2200F", ZERO_LENGTH_CHARACTER_STRING), - ("XX002", INDEX_CORRUPTED), - ("53300", TOO_MANY_CONNECTIONS), - ("38002", E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED), - ("22015", INTERVAL_FIELD_OVERFLOW), - ("22P01", FLOATING_POINT_EXCEPTION), - ("22012", DIVISION_BY_ZERO), - ("XX001", DATA_CORRUPTED), - ("0100C", WARNING_DYNAMIC_RESULT_SETS_RETURNED), - ("42P01", UNDEFINED_TABLE), - ("25002", BRANCH_TRANSACTION_ALREADY_ACTIVE), - ("2D000", INVALID_TRANSACTION_TERMINATION), - ("P0004", ASSERT_FAILURE), - ("2200C", INVALID_USE_OF_ESCAPE_CHARACTER), - ("HV00R", FDW_TABLE_NOT_FOUND), - ("22016", INVALID_ARGUMENT_FOR_NTH_VALUE), - ("01P01", WARNING_DEPRECATED_FEATURE), - ("F0000", CONFIG_FILE_ERROR), - ("0Z000", DIAGNOSTICS_EXCEPTION), - ("42P02", UNDEFINED_PARAMETER), - ("2200S", INVALID_XML_COMMENT), - ("2200H", SEQUENCE_GENERATOR_LIMIT_EXCEEDED), - ("HV00C", FDW_INVALID_OPTION_INDEX), - ("38004", E_R_E_READING_SQL_DATA_NOT_PERMITTED), - ("42703", UNDEFINED_COLUMN), - ("23503", FOREIGN_KEY_VIOLATION), - ("42000", SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION), - ("22004", NULL_VALUE_NOT_ALLOWED), - ("25008", HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL), - ("22018", INVALID_CHARACTER_VALUE_FOR_CAST), - ("22023", INVALID_PARAMETER_VALUE), - ("22011", SUBSTRING_ERROR), - ("40002", T_R_INTEGRITY_CONSTRAINT_VIOLATION), - ("42803", GROUPING_ERROR), - ("72000", SNAPSHOT_TOO_OLD), - ("HV010", FDW_FUNCTION_SEQUENCE_ERROR), - ("42809", WRONG_OBJECT_TYPE), - ("42P16", INVALID_TABLE_DEFINITION), - ("HV00D", FDW_INVALID_OPTION_NAME), - ("39000", EXTERNAL_ROUTINE_INVOCATION_EXCEPTION), - ("2202G", INVALID_TABLESAMPLE_REPEAT), - ("42601", SYNTAX_ERROR), - ("42622", NAME_TOO_LONG), - ("HV00L", FDW_UNABLE_TO_CREATE_EXECUTION), - ("25000", INVALID_TRANSACTION_STATE), - ("3B000", SAVEPOINT_EXCEPTION), - ("42P21", COLLATION_MISMATCH), - ("23505", UNIQUE_VIOLATION), - ("22001", STRING_DATA_RIGHT_TRUNCATION), - ("02001", NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED), - ("21000", CARDINALITY_VIOLATION), - ("58P01", UNDEFINED_FILE), - ("HV091", FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER), - ("25P01", NO_ACTIVE_SQL_TRANSACTION), - ("40P01", T_R_DEADLOCK_DETECTED), - ("HV021", FDW_INCONSISTENT_DESCRIPTOR_INFORMATION), - ("42P09", AMBIGUOUS_ALIAS), - ("25007", SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED), - ("23P01", EXCLUSION_VIOLATION), - ("HV00J", FDW_OPTION_NAME_NOT_FOUND), - ("58030", IO_ERROR), - ("HV004", FDW_INVALID_DATA_TYPE), - ("42710", DUPLICATE_OBJECT), - ("HV090", FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH), - ("42P18", INDETERMINATE_DATATYPE), - ("HV00M", FDW_UNABLE_TO_CREATE_REPLY), - ("42804", DATATYPE_MISMATCH), - ("24000", INVALID_CURSOR_STATE), - ("HV007", FDW_INVALID_COLUMN_NAME), - ("2201E", INVALID_ARGUMENT_FOR_LOG), - ("42P22", INDETERMINATE_COLLATION), - ("22P05", UNTRANSLATABLE_CHARACTER), - ("42P07", DUPLICATE_TABLE), - ("2F004", S_R_E_READING_SQL_DATA_NOT_PERMITTED), - ("23502", NOT_NULL_VIOLATION), - ("57000", OPERATOR_INTERVENTION), - ("HV000", FDW_ERROR), - ("42883", UNDEFINED_FUNCTION), - ("2201B", INVALID_REGULAR_EXPRESSION), - ("2200D", INVALID_ESCAPE_OCTET), - ("42P06", DUPLICATE_SCHEMA), - ("38003", E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), - ("22026", STRING_DATA_LENGTH_MISMATCH), - ("P0003", TOO_MANY_ROWS), - ("3D000", INVALID_CATALOG_NAME), - ("0B000", INVALID_TRANSACTION_INITIATION), - ("55006", OBJECT_IN_USE), - ("53200", OUT_OF_MEMORY), - ("3F000", INVALID_SCHEMA_NAME), - ("53100", DISK_FULL), - ("2F003", S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), - ("55P02", CANT_CHANGE_RUNTIME_PARAM), - ("01004", WARNING_STRING_DATA_RIGHT_TRUNCATION), - ("3B001", S_E_INVALID_SPECIFICATION), - ("2200G", MOST_SPECIFIC_TYPE_MISMATCH), - ("428C9", GENERATED_ALWAYS), - ("HV005", FDW_COLUMN_NAME_NOT_FOUND), - ("2201F", INVALID_ARGUMENT_FOR_POWER_FUNCTION), - ("22022", INDICATOR_OVERFLOW), - ("HV00Q", FDW_SCHEMA_NOT_FOUND), - ("0F000", LOCATOR_EXCEPTION), - ("22002", NULL_VALUE_NO_INDICATOR_PARAMETER), - ("02000", NO_DATA), - ("2202H", INVALID_TABLESAMPLE_ARGUMENT), - ("27000", TRIGGERED_DATA_CHANGE_VIOLATION), - ("2BP01", DEPENDENT_OBJECTS_STILL_EXIST), - ("55000", OBJECT_NOT_IN_PREREQUISITE_STATE), - ("39001", E_R_I_E_INVALID_SQLSTATE_RETURNED), - ("08004", SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION), - ("42P13", INVALID_FUNCTION_DEFINITION), - ("HV024", FDW_INVALID_ATTRIBUTE_VALUE), - ("22019", INVALID_ESCAPE_CHARACTER), - ("54000", PROGRAM_LIMIT_EXCEEDED), - ("42501", INSUFFICIENT_PRIVILEGE), - ("HV00A", FDW_INVALID_STRING_FORMAT), - ("42702", AMBIGUOUS_COLUMN), - ("53000", INSUFFICIENT_RESOURCES), - ("25P02", IN_FAILED_SQL_TRANSACTION), - ("22010", INVALID_INDICATOR_PARAMETER_VALUE), - ("01008", WARNING_IMPLICIT_ZERO_BIT_PADDING), - ("HV014", FDW_TOO_MANY_HANDLES), - ("42P20", WINDOWING_ERROR), - ("42725", AMBIGUOUS_FUNCTION), - ("F0001", LOCK_FILE_EXISTS), - ("08003", CONNECTION_DOES_NOT_EXIST), - ("2200M", INVALID_XML_DOCUMENT), - ("22003", NUMERIC_VALUE_OUT_OF_RANGE), - ("39004", E_R_I_E_NULL_VALUE_NOT_ALLOWED), - ("2200B", ESCAPE_CHARACTER_CONFLICT), - ("0P000", INVALID_ROLE_SPECIFICATION), - ("00000", SUCCESSFUL_COMPLETION), - ("22P02", INVALID_TEXT_REPRESENTATION), - ("25001", ACTIVE_SQL_TRANSACTION), - ("HV00N", FDW_UNABLE_TO_ESTABLISH_CONNECTION), - ("39P01", E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - ("2B000", DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST), - ("22008", DATETIME_FIELD_OVERFLOW), - ("42P14", INVALID_PSTATEMENT_DEFINITION), - ("57P04", DATABASE_DROPPED), - ("26000", INVALID_SQL_STATEMENT_NAME), - ("42P17", INVALID_OBJECT_DEFINITION), - ("42P04", DUPLICATE_DATABASE), - ("38001", E_R_E_CONTAINING_SQL_NOT_PERMITTED), - ("0Z002", STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER), - ("22007", INVALID_DATETIME_FORMAT), - ("40003", T_R_STATEMENT_COMPLETION_UNKNOWN), - ("42P12", INVALID_DATABASE_DEFINITION), - ("57P03", CANNOT_CONNECT_NOW), + ("23001", SqlState::RESTRICT_VIOLATION), + ("42830", SqlState::INVALID_FOREIGN_KEY), + ("P0000", SqlState::PLPGSQL_ERROR), + ("58000", SqlState::SYSTEM_ERROR), + ("57P01", SqlState::ADMIN_SHUTDOWN), + ("22P04", SqlState::BAD_COPY_FILE_FORMAT), + ("42P05", SqlState::DUPLICATE_PSTATEMENT), + ("28000", SqlState::INVALID_AUTHORIZATION_SPECIFICATION), + ("2202E", SqlState::ARRAY_ELEMENT_ERROR), + ("2F005", SqlState::S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT), + ("53400", SqlState::CONFIGURATION_LIMIT_EXCEEDED), + ("20000", SqlState::CASE_NOT_FOUND), + ("25004", SqlState::INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION), + ("09000", SqlState::TRIGGERED_ACTION_EXCEPTION), + ("42P10", SqlState::INVALID_COLUMN_REFERENCE), + ("39P03", SqlState::E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED), + ("08000", SqlState::CONNECTION_EXCEPTION), + ("08006", SqlState::CONNECTION_FAILURE), + ("2201W", SqlState::INVALID_ROW_COUNT_IN_LIMIT_CLAUSE), + ("03000", SqlState::SQL_STATEMENT_NOT_YET_COMPLETE), + ("22014", SqlState::INVALID_ARGUMENT_FOR_NTILE), + ("42611", SqlState::INVALID_COLUMN_DEFINITION), + ("42P11", SqlState::INVALID_CURSOR_DEFINITION), + ("2200N", SqlState::INVALID_XML_CONTENT), + ("57014", SqlState::QUERY_CANCELED), + ("01003", SqlState::WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION), + ("01000", SqlState::WARNING), + ("55P04", SqlState::UNSAFE_NEW_ENUM_VALUE_USAGE), + ("25003", SqlState::INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION), + ("2200L", SqlState::NOT_AN_XML_DOCUMENT), + ("42846", SqlState::CANNOT_COERCE), + ("55P03", SqlState::LOCK_NOT_AVAILABLE), + ("08007", SqlState::TRANSACTION_RESOLUTION_UNKNOWN), + ("XX000", SqlState::INTERNAL_ERROR), + ("22005", SqlState::ERROR_IN_ASSIGNMENT), + ("22P03", SqlState::INVALID_BINARY_REPRESENTATION), + ("2201X", SqlState::INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE), + ("54011", SqlState::TOO_MANY_COLUMNS), + ("HV008", SqlState::FDW_INVALID_COLUMN_NUMBER), + ("HV009", SqlState::FDW_INVALID_USE_OF_NULL_POINTER), + ("0LP01", SqlState::INVALID_GRANT_OPERATION), + ("42704", SqlState::UNDEFINED_OBJECT), + ("25005", SqlState::NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION), + ("25P03", SqlState::IDLE_IN_TRANSACTION_SESSION_TIMEOUT), + ("44000", SqlState::WITH_CHECK_OPTION_VIOLATION), + ("22024", SqlState::UNTERMINATED_C_STRING), + ("0L000", SqlState::INVALID_GRANTOR), + ("40000", SqlState::TRANSACTION_ROLLBACK), + ("42P08", SqlState::AMBIGUOUS_PARAMETER), + ("38000", SqlState::EXTERNAL_ROUTINE_EXCEPTION), + ("42939", SqlState::RESERVED_NAME), + ("40001", SqlState::T_R_SERIALIZATION_FAILURE), + ("HV00K", SqlState::FDW_REPLY_HANDLE), + ("2F002", SqlState::S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED), + ("HV001", SqlState::FDW_OUT_OF_MEMORY), + ("42P19", SqlState::INVALID_RECURSION), + ("HV002", SqlState::FDW_DYNAMIC_PARAMETER_VALUE_NEEDED), + ("0A000", SqlState::FEATURE_NOT_SUPPORTED), + ("58P02", SqlState::DUPLICATE_FILE), + ("25006", SqlState::READ_ONLY_SQL_TRANSACTION), + ("22009", SqlState::INVALID_TIME_ZONE_DISPLACEMENT_VALUE), + ("0F001", SqlState::L_E_INVALID_SPECIFICATION), + ("P0002", SqlState::NO_DATA_FOUND), + ("2F000", SqlState::SQL_ROUTINE_EXCEPTION), + ("01006", SqlState::WARNING_PRIVILEGE_NOT_REVOKED), + ("22025", SqlState::INVALID_ESCAPE_SEQUENCE), + ("22027", SqlState::TRIM_ERROR), + ("54001", SqlState::STATEMENT_TOO_COMPLEX), + ("42602", SqlState::INVALID_NAME), + ("54023", SqlState::TOO_MANY_ARGUMENTS), + ("2200T", SqlState::INVALID_XML_PROCESSING_INSTRUCTION), + ("01007", SqlState::WARNING_PRIVILEGE_NOT_GRANTED), + ("22000", SqlState::DATA_EXCEPTION), + ("28P01", SqlState::INVALID_PASSWORD), + ("23514", SqlState::CHECK_VIOLATION), + ("39P02", SqlState::E_R_I_E_SRF_PROTOCOL_VIOLATED), + ("57P02", SqlState::CRASH_SHUTDOWN), + ("42P03", SqlState::DUPLICATE_CURSOR), + ("22021", SqlState::CHARACTER_NOT_IN_REPERTOIRE), + ("HV00P", SqlState::FDW_NO_SCHEMAS), + ("42701", SqlState::DUPLICATE_COLUMN), + ("42P15", SqlState::INVALID_SCHEMA_DEFINITION), + ("HV00B", SqlState::FDW_INVALID_HANDLE), + ("34000", SqlState::INVALID_CURSOR_NAME), + ("22P06", SqlState::NONSTANDARD_USE_OF_ESCAPE_CHARACTER), + ("P0001", SqlState::RAISE_EXCEPTION), + ("08P01", SqlState::PROTOCOL_VIOLATION), + ("42723", SqlState::DUPLICATE_FUNCTION), + ("08001", SqlState::SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), + ("HV006", SqlState::FDW_INVALID_DATA_TYPE_DESCRIPTORS), + ("23000", SqlState::INTEGRITY_CONSTRAINT_VIOLATION), + ("42712", SqlState::DUPLICATE_ALIAS), + ("2201G", SqlState::INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION), + ("2200F", SqlState::ZERO_LENGTH_CHARACTER_STRING), + ("XX002", SqlState::INDEX_CORRUPTED), + ("53300", SqlState::TOO_MANY_CONNECTIONS), + ("38002", SqlState::E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED), + ("22015", SqlState::INTERVAL_FIELD_OVERFLOW), + ("22P01", SqlState::FLOATING_POINT_EXCEPTION), + ("22012", SqlState::DIVISION_BY_ZERO), + ("XX001", SqlState::DATA_CORRUPTED), + ("0100C", SqlState::WARNING_DYNAMIC_RESULT_SETS_RETURNED), + ("42P01", SqlState::UNDEFINED_TABLE), + ("25002", SqlState::BRANCH_TRANSACTION_ALREADY_ACTIVE), + ("2D000", SqlState::INVALID_TRANSACTION_TERMINATION), + ("P0004", SqlState::ASSERT_FAILURE), + ("2200C", SqlState::INVALID_USE_OF_ESCAPE_CHARACTER), + ("HV00R", SqlState::FDW_TABLE_NOT_FOUND), + ("22016", SqlState::INVALID_ARGUMENT_FOR_NTH_VALUE), + ("01P01", SqlState::WARNING_DEPRECATED_FEATURE), + ("F0000", SqlState::CONFIG_FILE_ERROR), + ("0Z000", SqlState::DIAGNOSTICS_EXCEPTION), + ("42P02", SqlState::UNDEFINED_PARAMETER), + ("2200S", SqlState::INVALID_XML_COMMENT), + ("2200H", SqlState::SEQUENCE_GENERATOR_LIMIT_EXCEEDED), + ("HV00C", SqlState::FDW_INVALID_OPTION_INDEX), + ("38004", SqlState::E_R_E_READING_SQL_DATA_NOT_PERMITTED), + ("42703", SqlState::UNDEFINED_COLUMN), + ("23503", SqlState::FOREIGN_KEY_VIOLATION), + ("42000", SqlState::SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION), + ("22004", SqlState::NULL_VALUE_NOT_ALLOWED), + ("25008", SqlState::HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL), + ("22018", SqlState::INVALID_CHARACTER_VALUE_FOR_CAST), + ("22023", SqlState::INVALID_PARAMETER_VALUE), + ("22011", SqlState::SUBSTRING_ERROR), + ("40002", SqlState::T_R_INTEGRITY_CONSTRAINT_VIOLATION), + ("42803", SqlState::GROUPING_ERROR), + ("72000", SqlState::SNAPSHOT_TOO_OLD), + ("HV010", SqlState::FDW_FUNCTION_SEQUENCE_ERROR), + ("42809", SqlState::WRONG_OBJECT_TYPE), + ("42P16", SqlState::INVALID_TABLE_DEFINITION), + ("HV00D", SqlState::FDW_INVALID_OPTION_NAME), + ("39000", SqlState::EXTERNAL_ROUTINE_INVOCATION_EXCEPTION), + ("2202G", SqlState::INVALID_TABLESAMPLE_REPEAT), + ("42601", SqlState::SYNTAX_ERROR), + ("42622", SqlState::NAME_TOO_LONG), + ("HV00L", SqlState::FDW_UNABLE_TO_CREATE_EXECUTION), + ("25000", SqlState::INVALID_TRANSACTION_STATE), + ("3B000", SqlState::SAVEPOINT_EXCEPTION), + ("42P21", SqlState::COLLATION_MISMATCH), + ("23505", SqlState::UNIQUE_VIOLATION), + ("22001", SqlState::STRING_DATA_RIGHT_TRUNCATION), + ("02001", SqlState::NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED), + ("21000", SqlState::CARDINALITY_VIOLATION), + ("58P01", SqlState::UNDEFINED_FILE), + ("HV091", SqlState::FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER), + ("25P01", SqlState::NO_ACTIVE_SQL_TRANSACTION), + ("40P01", SqlState::T_R_DEADLOCK_DETECTED), + ("HV021", SqlState::FDW_INCONSISTENT_DESCRIPTOR_INFORMATION), + ("42P09", SqlState::AMBIGUOUS_ALIAS), + ("25007", SqlState::SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED), + ("23P01", SqlState::EXCLUSION_VIOLATION), + ("HV00J", SqlState::FDW_OPTION_NAME_NOT_FOUND), + ("58030", SqlState::IO_ERROR), + ("HV004", SqlState::FDW_INVALID_DATA_TYPE), + ("42710", SqlState::DUPLICATE_OBJECT), + ("HV090", SqlState::FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH), + ("42P18", SqlState::INDETERMINATE_DATATYPE), + ("HV00M", SqlState::FDW_UNABLE_TO_CREATE_REPLY), + ("42804", SqlState::DATATYPE_MISMATCH), + ("24000", SqlState::INVALID_CURSOR_STATE), + ("HV007", SqlState::FDW_INVALID_COLUMN_NAME), + ("2201E", SqlState::INVALID_ARGUMENT_FOR_LOG), + ("42P22", SqlState::INDETERMINATE_COLLATION), + ("22P05", SqlState::UNTRANSLATABLE_CHARACTER), + ("42P07", SqlState::DUPLICATE_TABLE), + ("2F004", SqlState::S_R_E_READING_SQL_DATA_NOT_PERMITTED), + ("23502", SqlState::NOT_NULL_VIOLATION), + ("57000", SqlState::OPERATOR_INTERVENTION), + ("HV000", SqlState::FDW_ERROR), + ("42883", SqlState::UNDEFINED_FUNCTION), + ("2201B", SqlState::INVALID_REGULAR_EXPRESSION), + ("2200D", SqlState::INVALID_ESCAPE_OCTET), + ("42P06", SqlState::DUPLICATE_SCHEMA), + ("38003", SqlState::E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), + ("22026", SqlState::STRING_DATA_LENGTH_MISMATCH), + ("P0003", SqlState::TOO_MANY_ROWS), + ("3D000", SqlState::INVALID_CATALOG_NAME), + ("0B000", SqlState::INVALID_TRANSACTION_INITIATION), + ("55006", SqlState::OBJECT_IN_USE), + ("53200", SqlState::OUT_OF_MEMORY), + ("3F000", SqlState::INVALID_SCHEMA_NAME), + ("53100", SqlState::DISK_FULL), + ("2F003", SqlState::S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), + ("55P02", SqlState::CANT_CHANGE_RUNTIME_PARAM), + ("01004", SqlState::WARNING_STRING_DATA_RIGHT_TRUNCATION), + ("3B001", SqlState::S_E_INVALID_SPECIFICATION), + ("2200G", SqlState::MOST_SPECIFIC_TYPE_MISMATCH), + ("428C9", SqlState::GENERATED_ALWAYS), + ("HV005", SqlState::FDW_COLUMN_NAME_NOT_FOUND), + ("2201F", SqlState::INVALID_ARGUMENT_FOR_POWER_FUNCTION), + ("22022", SqlState::INDICATOR_OVERFLOW), + ("HV00Q", SqlState::FDW_SCHEMA_NOT_FOUND), + ("0F000", SqlState::LOCATOR_EXCEPTION), + ("22002", SqlState::NULL_VALUE_NO_INDICATOR_PARAMETER), + ("02000", SqlState::NO_DATA), + ("2202H", SqlState::INVALID_TABLESAMPLE_ARGUMENT), + ("27000", SqlState::TRIGGERED_DATA_CHANGE_VIOLATION), + ("2BP01", SqlState::DEPENDENT_OBJECTS_STILL_EXIST), + ("55000", SqlState::OBJECT_NOT_IN_PREREQUISITE_STATE), + ("39001", SqlState::E_R_I_E_INVALID_SQLSTATE_RETURNED), + ("08004", SqlState::SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION), + ("42P13", SqlState::INVALID_FUNCTION_DEFINITION), + ("HV024", SqlState::FDW_INVALID_ATTRIBUTE_VALUE), + ("22019", SqlState::INVALID_ESCAPE_CHARACTER), + ("54000", SqlState::PROGRAM_LIMIT_EXCEEDED), + ("42501", SqlState::INSUFFICIENT_PRIVILEGE), + ("HV00A", SqlState::FDW_INVALID_STRING_FORMAT), + ("42702", SqlState::AMBIGUOUS_COLUMN), + ("53000", SqlState::INSUFFICIENT_RESOURCES), + ("25P02", SqlState::IN_FAILED_SQL_TRANSACTION), + ("22010", SqlState::INVALID_INDICATOR_PARAMETER_VALUE), + ("01008", SqlState::WARNING_IMPLICIT_ZERO_BIT_PADDING), + ("HV014", SqlState::FDW_TOO_MANY_HANDLES), + ("42P20", SqlState::WINDOWING_ERROR), + ("42725", SqlState::AMBIGUOUS_FUNCTION), + ("F0001", SqlState::LOCK_FILE_EXISTS), + ("08003", SqlState::CONNECTION_DOES_NOT_EXIST), + ("2200M", SqlState::INVALID_XML_DOCUMENT), + ("22003", SqlState::NUMERIC_VALUE_OUT_OF_RANGE), + ("39004", SqlState::E_R_I_E_NULL_VALUE_NOT_ALLOWED), + ("2200B", SqlState::ESCAPE_CHARACTER_CONFLICT), + ("0P000", SqlState::INVALID_ROLE_SPECIFICATION), + ("00000", SqlState::SUCCESSFUL_COMPLETION), + ("22P02", SqlState::INVALID_TEXT_REPRESENTATION), + ("25001", SqlState::ACTIVE_SQL_TRANSACTION), + ("HV00N", SqlState::FDW_UNABLE_TO_ESTABLISH_CONNECTION), + ("39P01", SqlState::E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), + ("2B000", SqlState::DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST), + ("22008", SqlState::DATETIME_FIELD_OVERFLOW), + ("42P14", SqlState::INVALID_PSTATEMENT_DEFINITION), + ("57P04", SqlState::DATABASE_DROPPED), + ("26000", SqlState::INVALID_SQL_STATEMENT_NAME), + ("42P17", SqlState::INVALID_OBJECT_DEFINITION), + ("42P04", SqlState::DUPLICATE_DATABASE), + ("38001", SqlState::E_R_E_CONTAINING_SQL_NOT_PERMITTED), + ("0Z002", SqlState::STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER), + ("22007", SqlState::INVALID_DATETIME_FORMAT), + ("40003", SqlState::T_R_STATEMENT_COMPLETION_UNKNOWN), + ("42P12", SqlState::INVALID_DATABASE_DEFINITION), + ("57P03", SqlState::CANNOT_CONNECT_NOW), ]), }; diff --git a/postgres-shared/src/types/bit_vec.rs b/postgres-shared/src/types/bit_vec.rs index 2b067496..cd3f4743 100644 --- a/postgres-shared/src/types/bit_vec.rs +++ b/postgres-shared/src/types/bit_vec.rs @@ -4,7 +4,7 @@ use self::bit_vec::BitVec; use postgres_protocol::types; use std::error::Error; -use types::{FromSql, IsNull, ToSql, Type, BIT, VARBIT}; +use types::{FromSql, IsNull, ToSql, Type}; impl<'a> FromSql<'a> for BitVec { fn from_sql(_: &Type, raw: &[u8]) -> Result> { diff --git a/postgres-shared/src/types/chrono.rs b/postgres-shared/src/types/chrono.rs index a0fc4d63..0f305ea1 100644 --- a/postgres-shared/src/types/chrono.rs +++ b/postgres-shared/src/types/chrono.rs @@ -5,7 +5,7 @@ use self::chrono::{DateTime, Duration, FixedOffset, Local, NaiveDate, NaiveDateT use postgres_protocol::types; use std::error::Error; -use types::{FromSql, IsNull, ToSql, Type, DATE, TIME, TIMESTAMP, TIMESTAMPTZ}; +use types::{FromSql, IsNull, ToSql, Type}; fn base() -> NaiveDateTime { NaiveDate::from_ymd(2000, 1, 1).and_hms(0, 0, 0) diff --git a/postgres-shared/src/types/eui48.rs b/postgres-shared/src/types/eui48.rs index 59944db2..a4e1bb6b 100644 --- a/postgres-shared/src/types/eui48.rs +++ b/postgres-shared/src/types/eui48.rs @@ -4,7 +4,7 @@ use self::eui48::MacAddress; use postgres_protocol::types; use std::error::Error; -use types::{FromSql, IsNull, ToSql, Type, MACADDR}; +use types::{FromSql, IsNull, ToSql, Type}; impl<'a> FromSql<'a> for MacAddress { fn from_sql(_: &Type, raw: &[u8]) -> Result> { diff --git a/postgres-shared/src/types/geo.rs b/postgres-shared/src/types/geo.rs index 396bb791..d2cee694 100644 --- a/postgres-shared/src/types/geo.rs +++ b/postgres-shared/src/types/geo.rs @@ -5,7 +5,7 @@ use fallible_iterator::FallibleIterator; use postgres_protocol::types; use std::error::Error; -use types::{FromSql, IsNull, ToSql, Type, BOX, PATH, POINT}; +use types::{FromSql, IsNull, ToSql, Type}; impl<'a> FromSql<'a> for Point { fn from_sql(_: &Type, raw: &[u8]) -> Result> { diff --git a/postgres-shared/src/types/mod.rs b/postgres-shared/src/types/mod.rs index 94651813..69f9c6d4 100644 --- a/postgres-shared/src/types/mod.rs +++ b/postgres-shared/src/types/mod.rs @@ -15,16 +15,15 @@ use types::type_gen::{Inner, Other}; pub use postgres_protocol::Oid; pub use types::special::{Date, Timestamp}; -pub use types::type_gen::consts::*; /// Generates a simple implementation of `ToSql::accepts` which accepts the /// types passed to it. #[macro_export] macro_rules! accepts { - ($($expected:pat),+) => ( + ($($expected:ident),+) => ( fn accepts(ty: &$crate::types::Type) -> bool { match *ty { - $($expected)|+ => true, + $($crate::types::Type::$expected)|+ => true, _ => false } } @@ -411,7 +410,7 @@ impl<'a> FromSql<'a> for &'a str { fn accepts(ty: &Type) -> bool { match *ty { - VARCHAR | TEXT | BPCHAR | NAME | UNKNOWN => true, + Type::VARCHAR | Type::TEXT | Type::BPCHAR | Type::NAME | Type::UNKNOWN => true, ref ty if ty.name() == "citext" => true, _ => false, } @@ -419,7 +418,7 @@ impl<'a> FromSql<'a> for &'a str { } macro_rules! simple_from { - ($t:ty, $f:ident, $($expected:pat),+) => { + ($t:ty, $f:ident, $($expected:ident),+) => { impl<'a> FromSql<'a> for $t { fn from_sql(_: &Type, raw: &'a [u8]) -> Result<$t, Box> { types::$f(raw) @@ -513,8 +512,7 @@ pub enum IsNull { /// # Arrays /// /// `ToSql` is implemented for `Vec` and `&[T]` where `T` implements `ToSql`, -/// and corresponds to one-dimentional Postgres arrays with an index offset of -/// 1. +/// and corresponds to one-dimentional Postgres arrays with an index offset of 1. pub trait ToSql: fmt::Debug { /// Converts the value of `self` into the binary format of the specified /// Postgres `Type`, appending it to `out`. @@ -655,7 +653,7 @@ impl<'a> ToSql for &'a str { fn accepts(ty: &Type) -> bool { match *ty { - VARCHAR | TEXT | BPCHAR | NAME | UNKNOWN => true, + Type::VARCHAR | Type::TEXT | Type::BPCHAR | Type::NAME | Type::UNKNOWN => true, ref ty if ty.name() == "citext" => true, _ => false, } @@ -689,7 +687,7 @@ impl ToSql for String { } macro_rules! simple_to { - ($t:ty, $f:ident, $($expected:pat),+) => { + ($t:ty, $f:ident, $($expected:ident),+) => { impl ToSql for $t { fn to_sql(&self, _: &Type, diff --git a/postgres-shared/src/types/rustc_serialize.rs b/postgres-shared/src/types/rustc_serialize.rs index c47ecfb0..6df046e1 100644 --- a/postgres-shared/src/types/rustc_serialize.rs +++ b/postgres-shared/src/types/rustc_serialize.rs @@ -4,11 +4,11 @@ use self::rustc_serialize::json; use std::error::Error; use std::io::{Read, Write}; -use types::{FromSql, IsNull, ToSql, Type, JSON, JSONB}; +use types::{FromSql, IsNull, ToSql, Type}; impl<'a> FromSql<'a> for json::Json { fn from_sql(ty: &Type, mut raw: &[u8]) -> Result> { - if *ty == JSONB { + if *ty == Type::JSONB { let mut b = [0; 1]; raw.read_exact(&mut b)?; // We only support version 1 of the jsonb binary format @@ -24,7 +24,7 @@ impl<'a> FromSql<'a> for json::Json { impl ToSql for json::Json { fn to_sql(&self, ty: &Type, out: &mut Vec) -> Result> { - if *ty == JSONB { + if *ty == Type::JSONB { out.push(1); } write!(out, "{}", self)?; diff --git a/postgres-shared/src/types/serde_json.rs b/postgres-shared/src/types/serde_json.rs index 8e0bd770..53a63d58 100644 --- a/postgres-shared/src/types/serde_json.rs +++ b/postgres-shared/src/types/serde_json.rs @@ -4,11 +4,11 @@ use self::serde_json::Value; use std::error::Error; use std::io::{Read, Write}; -use types::{FromSql, IsNull, ToSql, Type, JSON, JSONB}; +use types::{FromSql, IsNull, ToSql, Type}; impl<'a> FromSql<'a> for Value { fn from_sql(ty: &Type, mut raw: &[u8]) -> Result> { - if *ty == JSONB { + if *ty == Type::JSONB { let mut b = [0; 1]; raw.read_exact(&mut b)?; // We only support version 1 of the jsonb binary format @@ -24,7 +24,7 @@ impl<'a> FromSql<'a> for Value { impl ToSql for Value { fn to_sql(&self, ty: &Type, out: &mut Vec) -> Result> { - if *ty == JSONB { + if *ty == Type::JSONB { out.push(1); } write!(out, "{}", self)?; diff --git a/postgres-shared/src/types/special.rs b/postgres-shared/src/types/special.rs index 5658a551..a0566319 100644 --- a/postgres-shared/src/types/special.rs +++ b/postgres-shared/src/types/special.rs @@ -2,7 +2,7 @@ use postgres_protocol::types; use std::error::Error; use std::{i32, i64}; -use types::{FromSql, IsNull, ToSql, Type, DATE, TIMESTAMP, TIMESTAMPTZ}; +use types::{FromSql, IsNull, ToSql, Type}; /// A wrapper that can be used to represent infinity with `Type::Date` types. #[derive(Debug, Clone, Copy, PartialEq)] @@ -25,7 +25,7 @@ impl<'a, T: FromSql<'a>> FromSql<'a> for Date { } fn accepts(ty: &Type) -> bool { - *ty == DATE && T::accepts(ty) + *ty == Type::DATE && T::accepts(ty) } } @@ -42,7 +42,7 @@ impl ToSql for Date { } fn accepts(ty: &Type) -> bool { - *ty == DATE && T::accepts(ty) + *ty == Type::DATE && T::accepts(ty) } to_sql_checked!(); @@ -71,7 +71,7 @@ impl<'a, T: FromSql<'a>> FromSql<'a> for Timestamp { fn accepts(ty: &Type) -> bool { match *ty { - TIMESTAMP | TIMESTAMPTZ if T::accepts(ty) => true, + Type::TIMESTAMP | Type::TIMESTAMPTZ if T::accepts(ty) => true, _ => false, } } @@ -91,7 +91,7 @@ impl ToSql for Timestamp { fn accepts(ty: &Type) -> bool { match *ty { - TIMESTAMP | TIMESTAMPTZ if T::accepts(ty) => true, + Type::TIMESTAMP | Type::TIMESTAMPTZ if T::accepts(ty) => true, _ => false, } } diff --git a/postgres-shared/src/types/time.rs b/postgres-shared/src/types/time.rs index e827953d..f042ce7d 100644 --- a/postgres-shared/src/types/time.rs +++ b/postgres-shared/src/types/time.rs @@ -4,7 +4,7 @@ use self::time::Timespec; use postgres_protocol::types; use std::error::Error; -use types::{FromSql, IsNull, ToSql, Type, TIMESTAMP, TIMESTAMPTZ}; +use types::{FromSql, IsNull, ToSql, Type}; const USEC_PER_SEC: i64 = 1_000_000; const NSEC_PER_USEC: i64 = 1_000; diff --git a/postgres-shared/src/types/type_gen.rs b/postgres-shared/src/types/type_gen.rs index 4aaa8dfc..3992112e 100644 --- a/postgres-shared/src/types/type_gen.rs +++ b/postgres-shared/src/types/type_gen.rs @@ -1345,10 +1345,7 @@ impl Inner { } } } -pub mod consts { - use types::Type; - use types::type_gen::Inner; - +impl Type { /// BOOL - boolean, 'true'/'false' pub const BOOL: Type = Type(Inner::Bool); diff --git a/postgres-shared/src/types/uuid.rs b/postgres-shared/src/types/uuid.rs index 7cba9161..d7a190d0 100644 --- a/postgres-shared/src/types/uuid.rs +++ b/postgres-shared/src/types/uuid.rs @@ -4,7 +4,7 @@ use self::uuid::Uuid; use postgres_protocol::types; use std::error::Error; -use types::{FromSql, IsNull, ToSql, Type, UUID}; +use types::{FromSql, IsNull, ToSql, Type}; impl<'a> FromSql<'a> for Uuid { fn from_sql(_: &Type, raw: &[u8]) -> Result> { diff --git a/postgres/src/lib.rs b/postgres/src/lib.rs index 4a001262..6a3a4d38 100644 --- a/postgres/src/lib.rs +++ b/postgres/src/lib.rs @@ -94,7 +94,7 @@ use std::result; use std::sync::Arc; use std::time::Duration; -use error::{DbError, UNDEFINED_COLUMN, UNDEFINED_TABLE}; +use error::{DbError, SqlState}; use notification::{Notification, Notifications}; use params::{IntoConnectParams, User}; use priv_io::MessageStream; @@ -102,7 +102,7 @@ use rows::Rows; use stmt::{Column, Statement}; use tls::TlsHandshake; use transaction::{IsolationLevel, Transaction}; -use types::{Field, FromSql, IsNull, Kind, Oid, ToSql, Type, CHAR, NAME, OID}; +use types::{Field, FromSql, IsNull, Kind, Oid, ToSql, Type}; #[doc(inline)] pub use error::Error; @@ -737,7 +737,7 @@ impl InnerConnection { ) { Ok(..) => {} // Range types weren't added until Postgres 9.2, so pg_range may not exist - Err(ref e) if e.code() == Some(&UNDEFINED_TABLE) => { + Err(ref e) if e.code() == Some(&SqlState::UNDEFINED_TABLE) => { self.raw_prepare( TYPEINFO_QUERY, "SELECT t.typname, t.typtype, t.typelem, NULL::OID, \ @@ -758,21 +758,25 @@ impl InnerConnection { #[allow(if_not_else)] fn read_type(&mut self, oid: Oid) -> Result { self.setup_typeinfo_query()?; - self.raw_execute(TYPEINFO_QUERY, "", 0, &[OID], &[&oid])?; + self.raw_execute(TYPEINFO_QUERY, "", 0, &[Type::OID], &[&oid])?; let mut row = None; self.read_rows(|r| row = Some(r))?; let get_raw = |i: usize| row.as_ref().and_then(|r| r.get(i)); let (name, type_, elem_oid, rngsubtype, basetype, schema, relid) = { - let name = String::from_sql_nullable(&NAME, get_raw(0)).map_err(error::conversion)?; - let type_ = i8::from_sql_nullable(&CHAR, get_raw(1)).map_err(error::conversion)?; - let elem_oid = Oid::from_sql_nullable(&OID, get_raw(2)).map_err(error::conversion)?; - let rngsubtype = - Option::::from_sql_nullable(&OID, get_raw(3)).map_err(error::conversion)?; - let basetype = Oid::from_sql_nullable(&OID, get_raw(4)).map_err(error::conversion)?; - let schema = String::from_sql_nullable(&NAME, get_raw(5)).map_err(error::conversion)?; - let relid = Oid::from_sql_nullable(&OID, get_raw(6)).map_err(error::conversion)?; + let name = + String::from_sql_nullable(&Type::NAME, get_raw(0)).map_err(error::conversion)?; + let type_ = i8::from_sql_nullable(&Type::CHAR, get_raw(1)).map_err(error::conversion)?; + let elem_oid = + Oid::from_sql_nullable(&Type::OID, get_raw(2)).map_err(error::conversion)?; + let rngsubtype = Option::::from_sql_nullable(&Type::OID, get_raw(3)) + .map_err(error::conversion)?; + let basetype = + Oid::from_sql_nullable(&Type::OID, get_raw(4)).map_err(error::conversion)?; + let schema = + String::from_sql_nullable(&Type::NAME, get_raw(5)).map_err(error::conversion)?; + let relid = Oid::from_sql_nullable(&Type::OID, get_raw(6)).map_err(error::conversion)?; (name, type_, elem_oid, rngsubtype, basetype, schema, relid) }; @@ -810,7 +814,7 @@ impl InnerConnection { ) { Ok(..) => {} // Postgres 9.0 doesn't have enumsortorder - Err(ref e) if e.code() == Some(&UNDEFINED_COLUMN) => { + Err(ref e) if e.code() == Some(&SqlState::UNDEFINED_COLUMN) => { self.raw_prepare( TYPEINFO_ENUM_QUERY, "SELECT enumlabel \ @@ -828,13 +832,14 @@ impl InnerConnection { fn read_enum_variants(&mut self, oid: Oid) -> Result> { self.setup_typeinfo_enum_query()?; - self.raw_execute(TYPEINFO_ENUM_QUERY, "", 0, &[OID], &[&oid])?; + self.raw_execute(TYPEINFO_ENUM_QUERY, "", 0, &[Type::OID], &[&oid])?; let mut rows = vec![]; self.read_rows(|row| rows.push(row))?; let mut variants = vec![]; for row in rows { - variants.push(String::from_sql_nullable(&NAME, row.get(0)).map_err(error::conversion)?); + variants + .push(String::from_sql_nullable(&Type::NAME, row.get(0)).map_err(error::conversion)?); } Ok(variants) @@ -861,15 +866,17 @@ impl InnerConnection { fn read_composite_fields(&mut self, relid: Oid) -> Result> { self.setup_typeinfo_composite_query()?; - self.raw_execute(TYPEINFO_COMPOSITE_QUERY, "", 0, &[OID], &[&relid])?; + self.raw_execute(TYPEINFO_COMPOSITE_QUERY, "", 0, &[Type::OID], &[&relid])?; let mut rows = vec![]; self.read_rows(|row| rows.push(row))?; let mut fields = vec![]; for row in rows { let (name, type_) = { - let name = String::from_sql_nullable(&NAME, row.get(0)).map_err(error::conversion)?; - let type_ = Oid::from_sql_nullable(&OID, row.get(1)).map_err(error::conversion)?; + let name = + String::from_sql_nullable(&Type::NAME, row.get(0)).map_err(error::conversion)?; + let type_ = + Oid::from_sql_nullable(&Type::OID, row.get(1)).map_err(error::conversion)?; (name, type_) }; let type_ = self.get_type(type_)?; diff --git a/postgres/tests/test.rs b/postgres/tests/test.rs index ba12c495..8a5947ee 100644 --- a/postgres/tests/test.rs +++ b/postgres/tests/test.rs @@ -12,12 +12,11 @@ extern crate url; use fallible_iterator::FallibleIterator; use postgres::error::ErrorPosition::Normal; -use postgres::error::{DbError, CARDINALITY_VIOLATION, INVALID_CATALOG_NAME, INVALID_PASSWORD, - QUERY_CANCELED, SYNTAX_ERROR, UNDEFINED_TABLE}; +use postgres::error::{DbError, SqlState}; use postgres::notification::Notification; use postgres::params::IntoConnectParams; use postgres::transaction::{self, IsolationLevel}; -use postgres::types::{FLOAT8, INT4, Kind, Oid, Type, WrongType, VARCHAR}; +use postgres::types::{Kind, Oid, Type, WrongType}; use postgres::{Connection, GenericConnection, HandleNotice, TlsMode}; use std::io; use std::thread; @@ -58,7 +57,7 @@ fn test_prepare_err() { )); let err = conn.prepare("invalid sql database").unwrap_err(); match err.as_db() { - Some(e) if e.code == SYNTAX_ERROR && e.position == Some(Normal(1)) => {} + Some(e) if e.code == SqlState::SYNTAX_ERROR && e.position == Some(Normal(1)) => {} _ => panic!("Unexpected result {:?}", err), } } @@ -66,7 +65,7 @@ fn test_prepare_err() { #[test] fn test_unknown_database() { match Connection::connect("postgres://postgres@localhost:5433/asdf", TlsMode::None) { - Err(ref e) if e.code() == Some(&INVALID_CATALOG_NAME) => {} + Err(ref e) if e.code() == Some(&SqlState::INVALID_CATALOG_NAME) => {} Err(resp) => panic!("Unexpected result {:?}", resp), _ => panic!("Unexpected result"), } @@ -429,7 +428,7 @@ fn test_batch_execute_error() { let stmt = conn.prepare("SELECT * FROM foo ORDER BY id"); match stmt { - Err(ref e) if e.code() == Some(&UNDEFINED_TABLE) => {} + Err(ref e) if e.code() == Some(&SqlState::UNDEFINED_TABLE) => {} Err(e) => panic!("unexpected error {:?}", e), _ => panic!("unexpected success"), } @@ -488,7 +487,7 @@ FROM (SELECT gs.i LIMIT 2) ss", )); match stmt.query(&[]) { - Err(ref e) if e.code() == Some(&CARDINALITY_VIOLATION) => {} + Err(ref e) if e.code() == Some(&SqlState::CARDINALITY_VIOLATION) => {} Err(err) => panic!("Unexpected error {:?}", err), Ok(_) => panic!("Expected failure"), }; @@ -540,7 +539,7 @@ fn test_param_types() { TlsMode::None, )); let stmt = or_panic!(conn.prepare("SELECT $1::INT, $2::VARCHAR")); - assert_eq!(stmt.param_types(), &[INT4, VARCHAR][..]); + assert_eq!(stmt.param_types(), &[Type::INT4, Type::VARCHAR][..]); } #[test] @@ -553,9 +552,9 @@ fn test_columns() { let cols = stmt.columns(); assert_eq!(2, cols.len()); assert_eq!(cols[0].name(), "a"); - assert_eq!(cols[0].type_(), &INT4); + assert_eq!(cols[0].type_(), &Type::INT4); assert_eq!(cols[1].name(), "b"); - assert_eq!(cols[1].type_(), &VARCHAR); + assert_eq!(cols[1].type_(), &Type::VARCHAR); } #[test] @@ -568,9 +567,9 @@ fn test_execute_counts() { 0, or_panic!(conn.execute( "CREATE TEMPORARY TABLE foo ( - id SERIAL PRIMARY KEY, - b INT - )", + id SERIAL PRIMARY KEY, + b INT + )", &[], )) ); @@ -898,7 +897,7 @@ fn test_cancel_query() { }); match conn.execute("SELECT pg_sleep(10)", &[]) { - Err(ref e) if e.code() == Some(&QUERY_CANCELED) => {} + Err(ref e) if e.code() == Some(&SqlState::QUERY_CANCELED) => {} Err(res) => panic!("Unexpected result {:?}", res), _ => panic!("Unexpected result"), } @@ -998,7 +997,7 @@ fn test_plaintext_pass_wrong_pass() { TlsMode::None, ); match ret { - Err(ref e) if e.code() == Some(&INVALID_PASSWORD) => {} + Err(ref e) if e.code() == Some(&SqlState::INVALID_PASSWORD) => {} Err(err) => panic!("Unexpected error {:?}", err), _ => panic!("Expected error"), } @@ -1029,7 +1028,7 @@ fn test_md5_pass_wrong_pass() { TlsMode::None, ); match ret { - Err(ref e) if e.code() == Some(&INVALID_PASSWORD) => {} + Err(ref e) if e.code() == Some(&SqlState::INVALID_PASSWORD) => {} Err(err) => panic!("Unexpected error {:?}", err), _ => panic!("Expected error"), } @@ -1063,7 +1062,7 @@ fn test_scram_pass_wrong_pass() { TlsMode::None, ); match ret { - Err(ref e) if e.code() == Some(&INVALID_PASSWORD) => {} + Err(ref e) if e.code() == Some(&SqlState::INVALID_PASSWORD) => {} Err(err) => panic!("Unexpected error {:?}", err), _ => panic!("Expected error"), } @@ -1244,7 +1243,7 @@ fn test_custom_range_element_type() { let stmt = or_panic!(conn.prepare("SELECT $1::floatrange")); let ty = &stmt.param_types()[0]; assert_eq!("floatrange", ty.name()); - assert_eq!(&Kind::Range(FLOAT8), ty.kind()); + assert_eq!(&Kind::Range(Type::FLOAT8), ty.kind()); } #[test] diff --git a/postgres/tests/types/mod.rs b/postgres/tests/types/mod.rs index 1aad85cd..86974fd6 100644 --- a/postgres/tests/types/mod.rs +++ b/postgres/tests/types/mod.rs @@ -5,8 +5,7 @@ use std::f64; use std::fmt; use std::result; -use postgres::types::{FromSql, FromSqlOwned, INT4, IsNull, Kind, ToSql, Type, WrongType, NUMERIC, - TEXT}; +use postgres::types::{FromSql, FromSqlOwned, IsNull, Kind, ToSql, Type, WrongType}; use postgres::{Connection, TlsMode}; #[cfg(feature = "with-bit-vec")] @@ -479,11 +478,11 @@ fn composite() { match *type_.kind() { Kind::Composite(ref fields) => { assert_eq!(fields[0].name(), "name"); - assert_eq!(fields[0].type_(), &TEXT); + assert_eq!(fields[0].type_(), &Type::TEXT); assert_eq!(fields[1].name(), "supplier"); - assert_eq!(fields[1].type_(), &INT4); + assert_eq!(fields[1].type_(), &Type::INT4); assert_eq!(fields[2].name(), "price"); - assert_eq!(fields[2].type_(), &NUMERIC); + assert_eq!(fields[2].type_(), &Type::NUMERIC); } ref t => panic!("bad type {:?}", t), } diff --git a/tokio-postgres/src/lib.rs b/tokio-postgres/src/lib.rs index 38f7b3e2..972c776b 100644 --- a/tokio-postgres/src/lib.rs +++ b/tokio-postgres/src/lib.rs @@ -89,7 +89,7 @@ pub use error::Error; #[doc(inline)] pub use postgres_shared::{error, params, types, CancelData, Notification}; -use error::{DbError, UNDEFINED_COLUMN, UNDEFINED_TABLE}; +use error::{DbError, SqlState}; use params::{ConnectParams, IntoConnectParams}; use rows::Row; use sink::SinkExt; @@ -97,7 +97,7 @@ use stmt::{Column, Statement}; use stream::PostgresStream; use tls::Handshake; use transaction::Transaction; -use types::{Field, FromSql, IsNull, Kind, Oid, ToSql, Type, CHAR, NAME, OID}; +use types::{Field, FromSql, IsNull, Kind, Oid, ToSql, Type}; #[macro_use] mod macros; @@ -717,36 +717,36 @@ impl Connection { oid: Oid, ) -> Box + Send> { self.setup_typeinfo_query() - .and_then(move |c| c.raw_execute(TYPEINFO_QUERY, "", &[OID], &[&oid])) + .and_then(move |c| c.raw_execute(TYPEINFO_QUERY, "", &[Type::OID], &[&oid])) .and_then(|c| c.read_rows().collect()) .and_then(move |(r, c)| { let get = |idx| r.get(0).and_then(|r| r.get(idx)); - let name = match String::from_sql_nullable(&NAME, get(0)) { + let name = match String::from_sql_nullable(&Type::NAME, get(0)) { Ok(v) => v, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; - let type_ = match i8::from_sql_nullable(&CHAR, get(1)) { + let type_ = match i8::from_sql_nullable(&Type::CHAR, get(1)) { Ok(v) => v, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; - let elem_oid = match Oid::from_sql_nullable(&OID, get(2)) { + let elem_oid = match Oid::from_sql_nullable(&Type::OID, get(2)) { Ok(v) => v, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; - let rngsubtype = match Option::::from_sql_nullable(&OID, get(3)) { + let rngsubtype = match Option::::from_sql_nullable(&Type::OID, get(3)) { Ok(v) => v, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; - let basetype = match Oid::from_sql_nullable(&OID, get(4)) { + let basetype = match Oid::from_sql_nullable(&Type::OID, get(4)) { Ok(v) => v, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; - let schema = match String::from_sql_nullable(&NAME, get(5)) { + let schema = match String::from_sql_nullable(&Type::NAME, get(5)) { Ok(v) => v, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; - let relid = match Oid::from_sql_nullable(&OID, get(6)) { + let relid = match Oid::from_sql_nullable(&Type::OID, get(6)) { Ok(v) => v, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; @@ -811,7 +811,7 @@ impl Connection { WHERE t.oid = $1", ).or_else(|(e, c)| { // Range types weren't added until Postgres 9.2, so pg_range may not exist - if e.code() == Some(&UNDEFINED_TABLE) { + if e.code() == Some(&SqlState::UNDEFINED_TABLE) { Either::A(c.raw_prepare( TYPEINFO_QUERY, "SELECT t.typname, t.typtype, t.typelem, \ @@ -838,12 +838,12 @@ impl Connection { oid: Oid, ) -> Box, Connection), Error = (Error, Connection)> + Send> { self.setup_typeinfo_enum_query() - .and_then(move |c| c.raw_execute(TYPEINFO_ENUM_QUERY, "", &[OID], &[&oid])) + .and_then(move |c| c.raw_execute(TYPEINFO_ENUM_QUERY, "", &[Type::OID], &[&oid])) .and_then(|c| c.read_rows().collect()) .and_then(|(r, c)| { let mut variants = vec![]; for row in r { - let variant = match String::from_sql_nullable(&NAME, row.get(0)) { + let variant = match String::from_sql_nullable(&Type::NAME, row.get(0)) { Ok(v) => v, Err(e) => return Err((error::conversion(e), c)), }; @@ -868,7 +868,7 @@ impl Connection { WHERE enumtypid = $1 \ ORDER BY enumsortorder", ).or_else(|(e, c)| { - if e.code() == Some(&UNDEFINED_COLUMN) { + if e.code() == Some(&SqlState::UNDEFINED_COLUMN) { Either::A(c.raw_prepare( TYPEINFO_ENUM_QUERY, "SELECT enumlabel FROM pg_catalog.pg_enum WHERE \ @@ -890,15 +890,15 @@ impl Connection { oid: Oid, ) -> Box, Connection), Error = (Error, Connection)> + Send> { self.setup_typeinfo_composite_query() - .and_then(move |c| c.raw_execute(TYPEINFO_COMPOSITE_QUERY, "", &[OID], &[&oid])) + .and_then(move |c| c.raw_execute(TYPEINFO_COMPOSITE_QUERY, "", &[Type::OID], &[&oid])) .and_then(|c| c.read_rows().collect()) .and_then(|(r, c)| { futures::stream::iter_ok(r).fold((vec![], c), |(mut fields, c), row| { - let name = match String::from_sql_nullable(&NAME, row.get(0)) { + let name = match String::from_sql_nullable(&Type::NAME, row.get(0)) { Ok(name) => name, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; - let oid = match Oid::from_sql_nullable(&OID, row.get(1)) { + let oid = match Oid::from_sql_nullable(&Type::OID, row.get(1)) { Ok(oid) => oid, Err(e) => return Either::A(Err((error::conversion(e), c)).into_future()), }; diff --git a/tokio-postgres/src/test.rs b/tokio-postgres/src/test.rs index 6130a90c..055bc46a 100644 --- a/tokio-postgres/src/test.rs +++ b/tokio-postgres/src/test.rs @@ -6,9 +6,9 @@ use std::time::Duration; use tokio_core::reactor::{Core, Interval}; use super::*; -use error::{INVALID_AUTHORIZATION_SPECIFICATION, INVALID_PASSWORD, QUERY_CANCELED}; +use error::SqlState; use params::{ConnectParams, Host}; -use types::{FromSql, INT4, IsNull, Kind, ToSql, Type, BYTEA, NUMERIC, TEXT}; +use types::{FromSql, IsNull, Kind, ToSql, Type}; #[test] fn md5_user() { @@ -48,7 +48,7 @@ fn md5_user_wrong_pass() { &handle, ); match l.run(done) { - Err(ref e) if e.code() == Some(&INVALID_PASSWORD) => {} + Err(ref e) if e.code() == Some(&SqlState::INVALID_PASSWORD) => {} Err(e) => panic!("unexpected error {}", e), Ok(_) => panic!("unexpected success"), } @@ -92,7 +92,7 @@ fn pass_user_wrong_pass() { &handle, ); match l.run(done) { - Err(ref e) if e.code() == Some(&INVALID_PASSWORD) => {} + Err(ref e) if e.code() == Some(&SqlState::INVALID_PASSWORD) => {} Err(e) => panic!("unexpected error {}", e), Ok(_) => panic!("unexpected success"), } @@ -128,7 +128,7 @@ fn batch_execute_err() { .and_then(|c| c.batch_execute("SELECT * FROM bogo")) .then(|r| match r { Err((e, s)) => { - assert_eq!(e.code(), Some(&UNDEFINED_TABLE)); + assert_eq!(e.code(), Some(&SqlState::UNDEFINED_TABLE)); s.batch_execute("SELECT * FROM foo") } Ok(_) => panic!("unexpected success"), @@ -259,7 +259,10 @@ fn ssl_user_ssl_required() { ); match l.run(done) { - Err(ref e) => assert_eq!(e.code(), Some(&INVALID_AUTHORIZATION_SPECIFICATION)), + Err(ref e) => assert_eq!( + e.code(), + Some(&SqlState::INVALID_AUTHORIZATION_SPECIFICATION) + ), Ok(_) => panic!("unexpected success"), } } @@ -305,7 +308,7 @@ fn domain() { fn accepts(ty: &Type) -> bool { match *ty.kind() { - Kind::Domain(BYTEA) => ty.name() == "session_id", + Kind::Domain(Type::BYTEA) => ty.name() == "session_id", _ => false, } } @@ -372,11 +375,11 @@ fn composite() { match *type_.kind() { Kind::Composite(ref fields) => { assert_eq!(fields[0].name(), "name"); - assert_eq!(fields[0].type_(), &TEXT); + assert_eq!(fields[0].type_(), &Type::TEXT); assert_eq!(fields[1].name(), "supplier"); - assert_eq!(fields[1].type_(), &INT4); + assert_eq!(fields[1].type_(), &Type::INT4); assert_eq!(fields[2].name(), "price"); - assert_eq!(fields[2].type_(), &NUMERIC); + assert_eq!(fields[2].type_(), &Type::NUMERIC); } ref t => panic!("bad type {:?}", t), } @@ -442,7 +445,7 @@ fn cancel() { let (select, cancel) = l.run(done).unwrap(); cancel.unwrap(); match select { - Err((e, _)) => assert_eq!(e.code(), Some(&QUERY_CANCELED)), + Err((e, _)) => assert_eq!(e.code(), Some(&SqlState::QUERY_CANCELED)), Ok(_) => panic!("unexpected success"), } }