# autogenerated by deps/error_codes.jl using https://www.postgresql.org/docs/current/errcodes-appendix.html

@cenum(Class,
    C00,
    C01,
    C02,
    C03,
    C08,
    C09,
    C0A,
    C0B,
    C0F,
    C0L,
    C0P,
    C0Z,
    C20,
    C21,
    C22,
    C23,
    C24,
    C25,
    C26,
    C27,
    C28,
    C2B,
    C2D,
    C2F,
    C34,
    C38,
    C39,
    C3B,
    C3D,
    C3F,
    C40,
    C42,
    C44,
    C53,
    C54,
    C55,
    C57,
    C58,
    C72,
    CF0,
    CHV,
    CP0,
    CXX,
    CUN,
)

@cenum(ErrorCode,
    E00000,
    E01000,
    E0100C,
    E01008,
    E01003,
    E01007,
    E01006,
    E01004,
    E01P01,
    E02000,
    E02001,
    E03000,
    E08000,
    E08003,
    E08006,
    E08001,
    E08004,
    E08007,
    E08P01,
    E09000,
    E0A000,
    E0B000,
    E0F000,
    E0F001,
    E0L000,
    E0LP01,
    E0P000,
    E0Z000,
    E0Z002,
    E20000,
    E21000,
    E22000,
    E2202E,
    E22021,
    E22008,
    E22012,
    E22005,
    E2200B,
    E22022,
    E22015,
    E2201E,
    E22014,
    E22016,
    E2201F,
    E2201G,
    E22018,
    E22007,
    E22019,
    E2200D,
    E22025,
    E22P06,
    E22010,
    E22023,
    E22013,
    E2201B,
    E2201W,
    E2201X,
    E2202H,
    E2202G,
    E22009,
    E2200C,
    E2200G,
    E22004,
    E22002,
    E22003,
    E2200H,
    E22026,
    E22001,
    E22011,
    E22027,
    E22024,
    E2200F,
    E22P01,
    E22P02,
    E22P03,
    E22P04,
    E22P05,
    E2200L,
    E2200M,
    E2200N,
    E2200S,
    E2200T,
    E22030,
    E22031,
    E22032,
    E22033,
    E22034,
    E22035,
    E22036,
    E22037,
    E22038,
    E22039,
    E2203A,
    E2203B,
    E2203C,
    E2203D,
    E2203E,
    E2203F,
    E23000,
    E23001,
    E23502,
    E23503,
    E23505,
    E23514,
    E23P01,
    E24000,
    E25000,
    E25001,
    E25002,
    E25008,
    E25003,
    E25004,
    E25005,
    E25006,
    E25007,
    E25P01,
    E25P02,
    E25P03,
    E26000,
    E27000,
    E28000,
    E28P01,
    E2B000,
    E2BP01,
    E2D000,
    E2F000,
    E2F005,
    E2F002,
    E2F003,
    E2F004,
    E34000,
    E38000,
    E38001,
    E38002,
    E38003,
    E38004,
    E39000,
    E39001,
    E39004,
    E39P01,
    E39P02,
    E39P03,
    E3B000,
    E3B001,
    E3D000,
    E3F000,
    E40000,
    E40002,
    E40001,
    E40003,
    E40P01,
    E42000,
    E42601,
    E42501,
    E42846,
    E42803,
    E42P20,
    E42P19,
    E42830,
    E42602,
    E42622,
    E42939,
    E42804,
    E42P18,
    E42P21,
    E42P22,
    E42809,
    E428C9,
    E42703,
    E42883,
    E42P01,
    E42P02,
    E42704,
    E42701,
    E42P03,
    E42P04,
    E42723,
    E42P05,
    E42P06,
    E42P07,
    E42712,
    E42710,
    E42702,
    E42725,
    E42P08,
    E42P09,
    E42P10,
    E42611,
    E42P11,
    E42P12,
    E42P13,
    E42P14,
    E42P15,
    E42P16,
    E42P17,
    E44000,
    E53000,
    E53100,
    E53200,
    E53300,
    E53400,
    E54000,
    E54001,
    E54011,
    E54023,
    E55000,
    E55006,
    E55P02,
    E55P03,
    E55P04,
    E57000,
    E57014,
    E57P01,
    E57P02,
    E57P03,
    E57P04,
    E58000,
    E58030,
    E58P01,
    E58P02,
    E72000,
    EF0000,
    EF0001,
    EHV000,
    EHV005,
    EHV002,
    EHV010,
    EHV021,
    EHV024,
    EHV007,
    EHV008,
    EHV004,
    EHV006,
    EHV091,
    EHV00B,
    EHV00C,
    EHV00D,
    EHV090,
    EHV00A,
    EHV009,
    EHV014,
    EHV001,
    EHV00P,
    EHV00J,
    EHV00K,
    EHV00Q,
    EHV00R,
    EHV00L,
    EHV00M,
    EHV00N,
    EP0000,
    EP0001,
    EP0002,
    EP0003,
    EP0004,
    EXX000,
    EXX001,
    EXX002,
    EUNOWN,
)


const SuccessfulCompletionClass = PQResultError{C00}

const SuccessfulCompletion = PQResultError{C00, E00000}


const WarningClass = PQResultError{C01}

const WarningWarning = PQResultError{C01, E01000}
const DynamicResultSetsReturnedWarning = PQResultError{C01, E0100C}
const ImplicitZeroBitPaddingWarning = PQResultError{C01, E01008}
const NullValueEliminatedInSetFunctionWarning = PQResultError{C01, E01003}
const PrivilegeNotGrantedWarning = PQResultError{C01, E01007}
const PrivilegeNotRevokedWarning = PQResultError{C01, E01006}
const StringDataRightTruncationWarning = PQResultError{C01, E01004}
const DeprecatedFeatureWarning = PQResultError{C01, E01P01}


const NoDataClass = PQResultError{C02}

const NoDataWarning = PQResultError{C02, E02000}
const NoAdditionalDynamicResultSetsReturnedWarning = PQResultError{C02, E02001}


const SqlStatementNotYetCompleteErrorClass = PQResultError{C03}

const SqlStatementNotYetComplete = PQResultError{C03, E03000}


const ConnectionExceptionErrorClass = PQResultError{C08}

const ConnectionException = PQResultError{C08, E08000}
const ConnectionDoesNotExist = PQResultError{C08, E08003}
const ConnectionFailure = PQResultError{C08, E08006}
const SqlclientUnableToEstablishSqlconnection = PQResultError{C08, E08001}
const SqlserverRejectedEstablishmentOfSqlconnection = PQResultError{C08, E08004}
const TransactionResolutionUnknown = PQResultError{C08, E08007}
const ProtocolViolation = PQResultError{C08, E08P01}


const TriggeredActionExceptionErrorClass = PQResultError{C09}

const TriggeredActionException = PQResultError{C09, E09000}


const FeatureNotSupportedErrorClass = PQResultError{C0A}

const FeatureNotSupported = PQResultError{C0A, E0A000}


const InvalidTransactionInitiationErrorClass = PQResultError{C0B}

const InvalidTransactionInitiation = PQResultError{C0B, E0B000}


const LocatorExceptionErrorClass = PQResultError{C0F}

const LocatorException = PQResultError{C0F, E0F000}
const InvalidLocatorSpecification = PQResultError{C0F, E0F001}


const InvalidGrantorErrorClass = PQResultError{C0L}

const InvalidGrantor = PQResultError{C0L, E0L000}
const InvalidGrantOperation = PQResultError{C0L, E0LP01}


const InvalidRoleSpecificationErrorClass = PQResultError{C0P}

const InvalidRoleSpecification = PQResultError{C0P, E0P000}


const DiagnosticsExceptionErrorClass = PQResultError{C0Z}

const DiagnosticsException = PQResultError{C0Z, E0Z000}
const StackedDiagnosticsAccessedWithoutActiveHandler = PQResultError{C0Z, E0Z002}


const CaseNotFoundErrorClass = PQResultError{C20}

const CaseNotFound = PQResultError{C20, E20000}


const CardinalityViolationErrorClass = PQResultError{C21}

const CardinalityViolation = PQResultError{C21, E21000}


const DataExceptionErrorClass = PQResultError{C22}

const DataException = PQResultError{C22, E22000}
const ArraySubscriptError = PQResultError{C22, E2202E}
const CharacterNotInRepertoire = PQResultError{C22, E22021}
const DatetimeFieldOverflow = PQResultError{C22, E22008}
const DivisionByZero = PQResultError{C22, E22012}
const ErrorInAssignment = PQResultError{C22, E22005}
const EscapeCharacterConflict = PQResultError{C22, E2200B}
const IndicatorOverflow = PQResultError{C22, E22022}
const IntervalFieldOverflow = PQResultError{C22, E22015}
const InvalidArgumentForLogarithm = PQResultError{C22, E2201E}
const InvalidArgumentForNtileFunction = PQResultError{C22, E22014}
const InvalidArgumentForNthValueFunction = PQResultError{C22, E22016}
const InvalidArgumentForPowerFunction = PQResultError{C22, E2201F}
const InvalidArgumentForWidthBucketFunction = PQResultError{C22, E2201G}
const InvalidCharacterValueForCast = PQResultError{C22, E22018}
const InvalidDatetimeFormat = PQResultError{C22, E22007}
const InvalidEscapeCharacter = PQResultError{C22, E22019}
const InvalidEscapeOctet = PQResultError{C22, E2200D}
const InvalidEscapeSequence = PQResultError{C22, E22025}
const NonstandardUseOfEscapeCharacter = PQResultError{C22, E22P06}
const InvalidIndicatorParameterValue = PQResultError{C22, E22010}
const InvalidParameterValue = PQResultError{C22, E22023}
const InvalidPrecedingOrFollowingSize = PQResultError{C22, E22013}
const InvalidRegularExpression = PQResultError{C22, E2201B}
const InvalidRowCountInLimitClause = PQResultError{C22, E2201W}
const InvalidRowCountInResultOffsetClause = PQResultError{C22, E2201X}
const InvalidTablesampleArgument = PQResultError{C22, E2202H}
const InvalidTablesampleRepeat = PQResultError{C22, E2202G}
const InvalidTimeZoneDisplacementValue = PQResultError{C22, E22009}
const InvalidUseOfEscapeCharacter = PQResultError{C22, E2200C}
const MostSpecificTypeMismatch = PQResultError{C22, E2200G}
const NullValueNotAllowed = PQResultError{C22, E22004}
const NullValueNoIndicatorParameter = PQResultError{C22, E22002}
const NumericValueOutOfRange = PQResultError{C22, E22003}
const SequenceGeneratorLimitExceeded = PQResultError{C22, E2200H}
const StringDataLengthMismatch = PQResultError{C22, E22026}
const StringDataRightTruncation = PQResultError{C22, E22001}
const SubstringError = PQResultError{C22, E22011}
const TrimError = PQResultError{C22, E22027}
const UnterminatedCString = PQResultError{C22, E22024}
const ZeroLengthCharacterString = PQResultError{C22, E2200F}
const FloatingPointException = PQResultError{C22, E22P01}
const InvalidTextRepresentation = PQResultError{C22, E22P02}
const InvalidBinaryRepresentation = PQResultError{C22, E22P03}
const BadCopyFileFormat = PQResultError{C22, E22P04}
const UntranslatableCharacter = PQResultError{C22, E22P05}
const NotAnXmlDocument = PQResultError{C22, E2200L}
const InvalidXmlDocument = PQResultError{C22, E2200M}
const InvalidXmlContent = PQResultError{C22, E2200N}
const InvalidXmlComment = PQResultError{C22, E2200S}
const InvalidXmlProcessingInstruction = PQResultError{C22, E2200T}
const DuplicateJsonObjectKeyValue = PQResultError{C22, E22030}
const InvalidArgumentForSqlJsonDatetimeFunction = PQResultError{C22, E22031}
const InvalidJsonText = PQResultError{C22, E22032}
const InvalidSqlJsonSubscript = PQResultError{C22, E22033}
const MoreThanOneSqlJsonItem = PQResultError{C22, E22034}
const NoSqlJsonItem = PQResultError{C22, E22035}
const NonNumericSqlJsonItem = PQResultError{C22, E22036}
const NonUniqueKeysInAJsonObject = PQResultError{C22, E22037}
const SingletonSqlJsonItemRequired = PQResultError{C22, E22038}
const SqlJsonArrayNotFound = PQResultError{C22, E22039}
const SqlJsonMemberNotFound = PQResultError{C22, E2203A}
const SqlJsonNumberNotFound = PQResultError{C22, E2203B}
const SqlJsonObjectNotFound = PQResultError{C22, E2203C}
const TooManyJsonArrayElements = PQResultError{C22, E2203D}
const TooManyJsonObjectMembers = PQResultError{C22, E2203E}
const SqlJsonScalarRequired = PQResultError{C22, E2203F}


const IntegrityConstraintViolationErrorClass = PQResultError{C23}

const IntegrityConstraintViolation = PQResultError{C23, E23000}
const RestrictViolation = PQResultError{C23, E23001}
const NotNullViolation = PQResultError{C23, E23502}
const ForeignKeyViolation = PQResultError{C23, E23503}
const UniqueViolation = PQResultError{C23, E23505}
const CheckViolation = PQResultError{C23, E23514}
const ExclusionViolation = PQResultError{C23, E23P01}


const InvalidCursorStateErrorClass = PQResultError{C24}

const InvalidCursorState = PQResultError{C24, E24000}


const InvalidTransactionStateErrorClass = PQResultError{C25}

const InvalidTransactionState = PQResultError{C25, E25000}
const ActiveSqlTransaction = PQResultError{C25, E25001}
const BranchTransactionAlreadyActive = PQResultError{C25, E25002}
const HeldCursorRequiresSameIsolationLevel = PQResultError{C25, E25008}
const InappropriateAccessModeForBranchTransaction = PQResultError{C25, E25003}
const InappropriateIsolationLevelForBranchTransaction = PQResultError{C25, E25004}
const NoActiveSqlTransactionForBranchTransaction = PQResultError{C25, E25005}
const ReadOnlySqlTransaction = PQResultError{C25, E25006}
const SchemaAndDataStatementMixingNotSupported = PQResultError{C25, E25007}
const NoActiveSqlTransaction = PQResultError{C25, E25P01}
const InFailedSqlTransaction = PQResultError{C25, E25P02}
const IdleInTransactionSessionTimeout = PQResultError{C25, E25P03}


const InvalidSqlStatementNameErrorClass = PQResultError{C26}

const InvalidSqlStatementName = PQResultError{C26, E26000}


const TriggeredDataChangeViolationErrorClass = PQResultError{C27}

const TriggeredDataChangeViolation = PQResultError{C27, E27000}


const InvalidAuthorizationSpecificationErrorClass = PQResultError{C28}

const InvalidAuthorizationSpecification = PQResultError{C28, E28000}
const InvalidPassword = PQResultError{C28, E28P01}


const DependentPrivilegeDescriptorsStillExistErrorClass = PQResultError{C2B}

const DependentPrivilegeDescriptorsStillExist = PQResultError{C2B, E2B000}
const DependentObjectsStillExist = PQResultError{C2B, E2BP01}


const InvalidTransactionTerminationErrorClass = PQResultError{C2D}

const InvalidTransactionTermination = PQResultError{C2D, E2D000}


const SqlRoutineExceptionErrorClass = PQResultError{C2F}

const SqlRoutineException = PQResultError{C2F, E2F000}
const FunctionExecutedNoReturnStatement = PQResultError{C2F, E2F005}
const ModifyingSqlDataNotPermitted = PQResultError{C2F, E2F002}
const ProhibitedSqlStatementAttempted = PQResultError{C2F, E2F003}
const ReadingSqlDataNotPermitted = PQResultError{C2F, E2F004}


const InvalidCursorNameErrorClass = PQResultError{C34}

const InvalidCursorName = PQResultError{C34, E34000}


const ExternalRoutineExceptionErrorClass = PQResultError{C38}

const ExternalRoutineException = PQResultError{C38, E38000}
const ContainingSqlNotPermitted = PQResultError{C38, E38001}
const ModifyingSqlDataNotPermittedExt = PQResultError{C38, E38002}
const ProhibitedSqlStatementAttemptedExt = PQResultError{C38, E38003}
const ReadingSqlDataNotPermittedExt = PQResultError{C38, E38004}


const ExternalRoutineInvocationExceptionErrorClass = PQResultError{C39}

const ExternalRoutineInvocationException = PQResultError{C39, E39000}
const InvalidSqlstateReturned = PQResultError{C39, E39001}
const NullValueNotAllowedExt = PQResultError{C39, E39004}
const TriggerProtocolViolated = PQResultError{C39, E39P01}
const SrfProtocolViolated = PQResultError{C39, E39P02}
const EventTriggerProtocolViolated = PQResultError{C39, E39P03}


const SavepointExceptionErrorClass = PQResultError{C3B}

const SavepointException = PQResultError{C3B, E3B000}
const InvalidSavepointSpecification = PQResultError{C3B, E3B001}


const InvalidCatalogNameErrorClass = PQResultError{C3D}

const InvalidCatalogName = PQResultError{C3D, E3D000}


const InvalidSchemaNameErrorClass = PQResultError{C3F}

const InvalidSchemaName = PQResultError{C3F, E3F000}


const TransactionRollbackErrorClass = PQResultError{C40}

const TransactionRollback = PQResultError{C40, E40000}
const TransactionIntegrityConstraintViolation = PQResultError{C40, E40002}
const SerializationFailure = PQResultError{C40, E40001}
const StatementCompletionUnknown = PQResultError{C40, E40003}
const DeadlockDetected = PQResultError{C40, E40P01}


const SyntaxErrorOrAccessRuleViolationErrorClass = PQResultError{C42}

const SyntaxErrorOrAccessRuleViolation = PQResultError{C42, E42000}
const SyntaxError = PQResultError{C42, E42601}
const InsufficientPrivilege = PQResultError{C42, E42501}
const CannotCoerce = PQResultError{C42, E42846}
const GroupingError = PQResultError{C42, E42803}
const WindowingError = PQResultError{C42, E42P20}
const InvalidRecursion = PQResultError{C42, E42P19}
const InvalidForeignKey = PQResultError{C42, E42830}
const InvalidName = PQResultError{C42, E42602}
const NameTooLong = PQResultError{C42, E42622}
const ReservedName = PQResultError{C42, E42939}
const DatatypeMismatch = PQResultError{C42, E42804}
const IndeterminateDatatype = PQResultError{C42, E42P18}
const CollationMismatch = PQResultError{C42, E42P21}
const IndeterminateCollation = PQResultError{C42, E42P22}
const WrongObjectType = PQResultError{C42, E42809}
const GeneratedAlways = PQResultError{C42, E428C9}
const UndefinedColumn = PQResultError{C42, E42703}
const UndefinedFunction = PQResultError{C42, E42883}
const UndefinedTable = PQResultError{C42, E42P01}
const UndefinedParameter = PQResultError{C42, E42P02}
const UndefinedObject = PQResultError{C42, E42704}
const DuplicateColumn = PQResultError{C42, E42701}
const DuplicateCursor = PQResultError{C42, E42P03}
const DuplicateDatabase = PQResultError{C42, E42P04}
const DuplicateFunction = PQResultError{C42, E42723}
const DuplicatePreparedStatement = PQResultError{C42, E42P05}
const DuplicateSchema = PQResultError{C42, E42P06}
const DuplicateTable = PQResultError{C42, E42P07}
const DuplicateAlias = PQResultError{C42, E42712}
const DuplicateObject = PQResultError{C42, E42710}
const AmbiguousColumn = PQResultError{C42, E42702}
const AmbiguousFunction = PQResultError{C42, E42725}
const AmbiguousParameter = PQResultError{C42, E42P08}
const AmbiguousAlias = PQResultError{C42, E42P09}
const InvalidColumnReference = PQResultError{C42, E42P10}
const InvalidColumnDefinition = PQResultError{C42, E42611}
const InvalidCursorDefinition = PQResultError{C42, E42P11}
const InvalidDatabaseDefinition = PQResultError{C42, E42P12}
const InvalidFunctionDefinition = PQResultError{C42, E42P13}
const InvalidPreparedStatementDefinition = PQResultError{C42, E42P14}
const InvalidSchemaDefinition = PQResultError{C42, E42P15}
const InvalidTableDefinition = PQResultError{C42, E42P16}
const InvalidObjectDefinition = PQResultError{C42, E42P17}


const WithCheckOptionViolationErrorClass = PQResultError{C44}

const WithCheckOptionViolation = PQResultError{C44, E44000}


const InsufficientResourcesErrorClass = PQResultError{C53}

const InsufficientResources = PQResultError{C53, E53000}
const DiskFull = PQResultError{C53, E53100}
const OutOfMemory = PQResultError{C53, E53200}
const TooManyConnections = PQResultError{C53, E53300}
const ConfigurationLimitExceeded = PQResultError{C53, E53400}


const ProgramLimitExceededErrorClass = PQResultError{C54}

const ProgramLimitExceeded = PQResultError{C54, E54000}
const StatementTooComplex = PQResultError{C54, E54001}
const TooManyColumns = PQResultError{C54, E54011}
const TooManyArguments = PQResultError{C54, E54023}


const ObjectNotInPrerequisiteStateErrorClass = PQResultError{C55}

const ObjectNotInPrerequisiteState = PQResultError{C55, E55000}
const ObjectInUse = PQResultError{C55, E55006}
const CantChangeRuntimeParam = PQResultError{C55, E55P02}
const LockNotAvailable = PQResultError{C55, E55P03}
const UnsafeNewEnumValueUsage = PQResultError{C55, E55P04}


const OperatorInterventionErrorClass = PQResultError{C57}

const OperatorIntervention = PQResultError{C57, E57000}
const QueryCanceled = PQResultError{C57, E57014}
const AdminShutdown = PQResultError{C57, E57P01}
const CrashShutdown = PQResultError{C57, E57P02}
const CannotConnectNow = PQResultError{C57, E57P03}
const DatabaseDropped = PQResultError{C57, E57P04}


const SystemErrorErrorClass = PQResultError{C58}

const SystemError = PQResultError{C58, E58000}
const IoError = PQResultError{C58, E58030}
const UndefinedFile = PQResultError{C58, E58P01}
const DuplicateFile = PQResultError{C58, E58P02}


const SnapshotTooOldErrorClass = PQResultError{C72}

const SnapshotTooOld = PQResultError{C72, E72000}


const ConfigFileErrorErrorClass = PQResultError{CF0}

const ConfigFileError = PQResultError{CF0, EF0000}
const LockFileExists = PQResultError{CF0, EF0001}


const FdwErrorErrorClass = PQResultError{CHV}

const FdwError = PQResultError{CHV, EHV000}
const FdwColumnNameNotFound = PQResultError{CHV, EHV005}
const FdwDynamicParameterValueNeeded = PQResultError{CHV, EHV002}
const FdwFunctionSequenceError = PQResultError{CHV, EHV010}
const FdwInconsistentDescriptorInformation = PQResultError{CHV, EHV021}
const FdwInvalidAttributeValue = PQResultError{CHV, EHV024}
const FdwInvalidColumnName = PQResultError{CHV, EHV007}
const FdwInvalidColumnNumber = PQResultError{CHV, EHV008}
const FdwInvalidDataType = PQResultError{CHV, EHV004}
const FdwInvalidDataTypeDescriptors = PQResultError{CHV, EHV006}
const FdwInvalidDescriptorFieldIdentifier = PQResultError{CHV, EHV091}
const FdwInvalidHandle = PQResultError{CHV, EHV00B}
const FdwInvalidOptionIndex = PQResultError{CHV, EHV00C}
const FdwInvalidOptionName = PQResultError{CHV, EHV00D}
const FdwInvalidStringLengthOrBufferLength = PQResultError{CHV, EHV090}
const FdwInvalidStringFormat = PQResultError{CHV, EHV00A}
const FdwInvalidUseOfNullPointer = PQResultError{CHV, EHV009}
const FdwTooManyHandles = PQResultError{CHV, EHV014}
const FdwOutOfMemory = PQResultError{CHV, EHV001}
const FdwNoSchemas = PQResultError{CHV, EHV00P}
const FdwOptionNameNotFound = PQResultError{CHV, EHV00J}
const FdwReplyHandle = PQResultError{CHV, EHV00K}
const FdwSchemaNotFound = PQResultError{CHV, EHV00Q}
const FdwTableNotFound = PQResultError{CHV, EHV00R}
const FdwUnableToCreateExecution = PQResultError{CHV, EHV00L}
const FdwUnableToCreateReply = PQResultError{CHV, EHV00M}
const FdwUnableToEstablishConnection = PQResultError{CHV, EHV00N}


const PlpgsqlErrorErrorClass = PQResultError{CP0}

const PlpgsqlError = PQResultError{CP0, EP0000}
const RaiseException = PQResultError{CP0, EP0001}
const NoDataFound = PQResultError{CP0, EP0002}
const TooManyRows = PQResultError{CP0, EP0003}
const AssertFailure = PQResultError{CP0, EP0004}


const InternalErrorErrorClass = PQResultError{CXX}

const InternalError = PQResultError{CXX, EXX000}
const DataCorrupted = PQResultError{CXX, EXX001}
const IndexCorrupted = PQResultError{CXX, EXX002}


const UnknownErrorClass = PQResultError{CUN}

const UnknownError = PQResultError{CUN, EUNOWN}

const ERROR_NAMES = Dict(
    SuccessfulCompletion => "SuccessfulCompletion",
    WarningWarning => "WarningWarning",
    DynamicResultSetsReturnedWarning => "DynamicResultSetsReturnedWarning",
    ImplicitZeroBitPaddingWarning => "ImplicitZeroBitPaddingWarning",
    NullValueEliminatedInSetFunctionWarning => "NullValueEliminatedInSetFunctionWarning",
    PrivilegeNotGrantedWarning => "PrivilegeNotGrantedWarning",
    PrivilegeNotRevokedWarning => "PrivilegeNotRevokedWarning",
    StringDataRightTruncationWarning => "StringDataRightTruncationWarning",
    DeprecatedFeatureWarning => "DeprecatedFeatureWarning",
    NoDataWarning => "NoDataWarning",
    NoAdditionalDynamicResultSetsReturnedWarning => "NoAdditionalDynamicResultSetsReturnedWarning",
    SqlStatementNotYetComplete => "SqlStatementNotYetComplete",
    ConnectionException => "ConnectionException",
    ConnectionDoesNotExist => "ConnectionDoesNotExist",
    ConnectionFailure => "ConnectionFailure",
    SqlclientUnableToEstablishSqlconnection => "SqlclientUnableToEstablishSqlconnection",
    SqlserverRejectedEstablishmentOfSqlconnection => "SqlserverRejectedEstablishmentOfSqlconnection",
    TransactionResolutionUnknown => "TransactionResolutionUnknown",
    ProtocolViolation => "ProtocolViolation",
    TriggeredActionException => "TriggeredActionException",
    FeatureNotSupported => "FeatureNotSupported",
    InvalidTransactionInitiation => "InvalidTransactionInitiation",
    LocatorException => "LocatorException",
    InvalidLocatorSpecification => "InvalidLocatorSpecification",
    InvalidGrantor => "InvalidGrantor",
    InvalidGrantOperation => "InvalidGrantOperation",
    InvalidRoleSpecification => "InvalidRoleSpecification",
    DiagnosticsException => "DiagnosticsException",
    StackedDiagnosticsAccessedWithoutActiveHandler => "StackedDiagnosticsAccessedWithoutActiveHandler",
    CaseNotFound => "CaseNotFound",
    CardinalityViolation => "CardinalityViolation",
    DataException => "DataException",
    ArraySubscriptError => "ArraySubscriptError",
    CharacterNotInRepertoire => "CharacterNotInRepertoire",
    DatetimeFieldOverflow => "DatetimeFieldOverflow",
    DivisionByZero => "DivisionByZero",
    ErrorInAssignment => "ErrorInAssignment",
    EscapeCharacterConflict => "EscapeCharacterConflict",
    IndicatorOverflow => "IndicatorOverflow",
    IntervalFieldOverflow => "IntervalFieldOverflow",
    InvalidArgumentForLogarithm => "InvalidArgumentForLogarithm",
    InvalidArgumentForNtileFunction => "InvalidArgumentForNtileFunction",
    InvalidArgumentForNthValueFunction => "InvalidArgumentForNthValueFunction",
    InvalidArgumentForPowerFunction => "InvalidArgumentForPowerFunction",
    InvalidArgumentForWidthBucketFunction => "InvalidArgumentForWidthBucketFunction",
    InvalidCharacterValueForCast => "InvalidCharacterValueForCast",
    InvalidDatetimeFormat => "InvalidDatetimeFormat",
    InvalidEscapeCharacter => "InvalidEscapeCharacter",
    InvalidEscapeOctet => "InvalidEscapeOctet",
    InvalidEscapeSequence => "InvalidEscapeSequence",
    NonstandardUseOfEscapeCharacter => "NonstandardUseOfEscapeCharacter",
    InvalidIndicatorParameterValue => "InvalidIndicatorParameterValue",
    InvalidParameterValue => "InvalidParameterValue",
    InvalidPrecedingOrFollowingSize => "InvalidPrecedingOrFollowingSize",
    InvalidRegularExpression => "InvalidRegularExpression",
    InvalidRowCountInLimitClause => "InvalidRowCountInLimitClause",
    InvalidRowCountInResultOffsetClause => "InvalidRowCountInResultOffsetClause",
    InvalidTablesampleArgument => "InvalidTablesampleArgument",
    InvalidTablesampleRepeat => "InvalidTablesampleRepeat",
    InvalidTimeZoneDisplacementValue => "InvalidTimeZoneDisplacementValue",
    InvalidUseOfEscapeCharacter => "InvalidUseOfEscapeCharacter",
    MostSpecificTypeMismatch => "MostSpecificTypeMismatch",
    NullValueNotAllowed => "NullValueNotAllowed",
    NullValueNoIndicatorParameter => "NullValueNoIndicatorParameter",
    NumericValueOutOfRange => "NumericValueOutOfRange",
    SequenceGeneratorLimitExceeded => "SequenceGeneratorLimitExceeded",
    StringDataLengthMismatch => "StringDataLengthMismatch",
    StringDataRightTruncation => "StringDataRightTruncation",
    SubstringError => "SubstringError",
    TrimError => "TrimError",
    UnterminatedCString => "UnterminatedCString",
    ZeroLengthCharacterString => "ZeroLengthCharacterString",
    FloatingPointException => "FloatingPointException",
    InvalidTextRepresentation => "InvalidTextRepresentation",
    InvalidBinaryRepresentation => "InvalidBinaryRepresentation",
    BadCopyFileFormat => "BadCopyFileFormat",
    UntranslatableCharacter => "UntranslatableCharacter",
    NotAnXmlDocument => "NotAnXmlDocument",
    InvalidXmlDocument => "InvalidXmlDocument",
    InvalidXmlContent => "InvalidXmlContent",
    InvalidXmlComment => "InvalidXmlComment",
    InvalidXmlProcessingInstruction => "InvalidXmlProcessingInstruction",
    DuplicateJsonObjectKeyValue => "DuplicateJsonObjectKeyValue",
    InvalidArgumentForSqlJsonDatetimeFunction => "InvalidArgumentForSqlJsonDatetimeFunction",
    InvalidJsonText => "InvalidJsonText",
    InvalidSqlJsonSubscript => "InvalidSqlJsonSubscript",
    MoreThanOneSqlJsonItem => "MoreThanOneSqlJsonItem",
    NoSqlJsonItem => "NoSqlJsonItem",
    NonNumericSqlJsonItem => "NonNumericSqlJsonItem",
    NonUniqueKeysInAJsonObject => "NonUniqueKeysInAJsonObject",
    SingletonSqlJsonItemRequired => "SingletonSqlJsonItemRequired",
    SqlJsonArrayNotFound => "SqlJsonArrayNotFound",
    SqlJsonMemberNotFound => "SqlJsonMemberNotFound",
    SqlJsonNumberNotFound => "SqlJsonNumberNotFound",
    SqlJsonObjectNotFound => "SqlJsonObjectNotFound",
    TooManyJsonArrayElements => "TooManyJsonArrayElements",
    TooManyJsonObjectMembers => "TooManyJsonObjectMembers",
    SqlJsonScalarRequired => "SqlJsonScalarRequired",
    IntegrityConstraintViolation => "IntegrityConstraintViolation",
    RestrictViolation => "RestrictViolation",
    NotNullViolation => "NotNullViolation",
    ForeignKeyViolation => "ForeignKeyViolation",
    UniqueViolation => "UniqueViolation",
    CheckViolation => "CheckViolation",
    ExclusionViolation => "ExclusionViolation",
    InvalidCursorState => "InvalidCursorState",
    InvalidTransactionState => "InvalidTransactionState",
    ActiveSqlTransaction => "ActiveSqlTransaction",
    BranchTransactionAlreadyActive => "BranchTransactionAlreadyActive",
    HeldCursorRequiresSameIsolationLevel => "HeldCursorRequiresSameIsolationLevel",
    InappropriateAccessModeForBranchTransaction => "InappropriateAccessModeForBranchTransaction",
    InappropriateIsolationLevelForBranchTransaction => "InappropriateIsolationLevelForBranchTransaction",
    NoActiveSqlTransactionForBranchTransaction => "NoActiveSqlTransactionForBranchTransaction",
    ReadOnlySqlTransaction => "ReadOnlySqlTransaction",
    SchemaAndDataStatementMixingNotSupported => "SchemaAndDataStatementMixingNotSupported",
    NoActiveSqlTransaction => "NoActiveSqlTransaction",
    InFailedSqlTransaction => "InFailedSqlTransaction",
    IdleInTransactionSessionTimeout => "IdleInTransactionSessionTimeout",
    InvalidSqlStatementName => "InvalidSqlStatementName",
    TriggeredDataChangeViolation => "TriggeredDataChangeViolation",
    InvalidAuthorizationSpecification => "InvalidAuthorizationSpecification",
    InvalidPassword => "InvalidPassword",
    DependentPrivilegeDescriptorsStillExist => "DependentPrivilegeDescriptorsStillExist",
    DependentObjectsStillExist => "DependentObjectsStillExist",
    InvalidTransactionTermination => "InvalidTransactionTermination",
    SqlRoutineException => "SqlRoutineException",
    FunctionExecutedNoReturnStatement => "FunctionExecutedNoReturnStatement",
    ModifyingSqlDataNotPermitted => "ModifyingSqlDataNotPermitted",
    ProhibitedSqlStatementAttempted => "ProhibitedSqlStatementAttempted",
    ReadingSqlDataNotPermitted => "ReadingSqlDataNotPermitted",
    InvalidCursorName => "InvalidCursorName",
    ExternalRoutineException => "ExternalRoutineException",
    ContainingSqlNotPermitted => "ContainingSqlNotPermitted",
    ModifyingSqlDataNotPermittedExt => "ModifyingSqlDataNotPermittedExt",
    ProhibitedSqlStatementAttemptedExt => "ProhibitedSqlStatementAttemptedExt",
    ReadingSqlDataNotPermittedExt => "ReadingSqlDataNotPermittedExt",
    ExternalRoutineInvocationException => "ExternalRoutineInvocationException",
    InvalidSqlstateReturned => "InvalidSqlstateReturned",
    NullValueNotAllowedExt => "NullValueNotAllowedExt",
    TriggerProtocolViolated => "TriggerProtocolViolated",
    SrfProtocolViolated => "SrfProtocolViolated",
    EventTriggerProtocolViolated => "EventTriggerProtocolViolated",
    SavepointException => "SavepointException",
    InvalidSavepointSpecification => "InvalidSavepointSpecification",
    InvalidCatalogName => "InvalidCatalogName",
    InvalidSchemaName => "InvalidSchemaName",
    TransactionRollback => "TransactionRollback",
    TransactionIntegrityConstraintViolation => "TransactionIntegrityConstraintViolation",
    SerializationFailure => "SerializationFailure",
    StatementCompletionUnknown => "StatementCompletionUnknown",
    DeadlockDetected => "DeadlockDetected",
    SyntaxErrorOrAccessRuleViolation => "SyntaxErrorOrAccessRuleViolation",
    SyntaxError => "SyntaxError",
    InsufficientPrivilege => "InsufficientPrivilege",
    CannotCoerce => "CannotCoerce",
    GroupingError => "GroupingError",
    WindowingError => "WindowingError",
    InvalidRecursion => "InvalidRecursion",
    InvalidForeignKey => "InvalidForeignKey",
    InvalidName => "InvalidName",
    NameTooLong => "NameTooLong",
    ReservedName => "ReservedName",
    DatatypeMismatch => "DatatypeMismatch",
    IndeterminateDatatype => "IndeterminateDatatype",
    CollationMismatch => "CollationMismatch",
    IndeterminateCollation => "IndeterminateCollation",
    WrongObjectType => "WrongObjectType",
    GeneratedAlways => "GeneratedAlways",
    UndefinedColumn => "UndefinedColumn",
    UndefinedFunction => "UndefinedFunction",
    UndefinedTable => "UndefinedTable",
    UndefinedParameter => "UndefinedParameter",
    UndefinedObject => "UndefinedObject",
    DuplicateColumn => "DuplicateColumn",
    DuplicateCursor => "DuplicateCursor",
    DuplicateDatabase => "DuplicateDatabase",
    DuplicateFunction => "DuplicateFunction",
    DuplicatePreparedStatement => "DuplicatePreparedStatement",
    DuplicateSchema => "DuplicateSchema",
    DuplicateTable => "DuplicateTable",
    DuplicateAlias => "DuplicateAlias",
    DuplicateObject => "DuplicateObject",
    AmbiguousColumn => "AmbiguousColumn",
    AmbiguousFunction => "AmbiguousFunction",
    AmbiguousParameter => "AmbiguousParameter",
    AmbiguousAlias => "AmbiguousAlias",
    InvalidColumnReference => "InvalidColumnReference",
    InvalidColumnDefinition => "InvalidColumnDefinition",
    InvalidCursorDefinition => "InvalidCursorDefinition",
    InvalidDatabaseDefinition => "InvalidDatabaseDefinition",
    InvalidFunctionDefinition => "InvalidFunctionDefinition",
    InvalidPreparedStatementDefinition => "InvalidPreparedStatementDefinition",
    InvalidSchemaDefinition => "InvalidSchemaDefinition",
    InvalidTableDefinition => "InvalidTableDefinition",
    InvalidObjectDefinition => "InvalidObjectDefinition",
    WithCheckOptionViolation => "WithCheckOptionViolation",
    InsufficientResources => "InsufficientResources",
    DiskFull => "DiskFull",
    OutOfMemory => "OutOfMemory",
    TooManyConnections => "TooManyConnections",
    ConfigurationLimitExceeded => "ConfigurationLimitExceeded",
    ProgramLimitExceeded => "ProgramLimitExceeded",
    StatementTooComplex => "StatementTooComplex",
    TooManyColumns => "TooManyColumns",
    TooManyArguments => "TooManyArguments",
    ObjectNotInPrerequisiteState => "ObjectNotInPrerequisiteState",
    ObjectInUse => "ObjectInUse",
    CantChangeRuntimeParam => "CantChangeRuntimeParam",
    LockNotAvailable => "LockNotAvailable",
    UnsafeNewEnumValueUsage => "UnsafeNewEnumValueUsage",
    OperatorIntervention => "OperatorIntervention",
    QueryCanceled => "QueryCanceled",
    AdminShutdown => "AdminShutdown",
    CrashShutdown => "CrashShutdown",
    CannotConnectNow => "CannotConnectNow",
    DatabaseDropped => "DatabaseDropped",
    SystemError => "SystemError",
    IoError => "IoError",
    UndefinedFile => "UndefinedFile",
    DuplicateFile => "DuplicateFile",
    SnapshotTooOld => "SnapshotTooOld",
    ConfigFileError => "ConfigFileError",
    LockFileExists => "LockFileExists",
    FdwError => "FdwError",
    FdwColumnNameNotFound => "FdwColumnNameNotFound",
    FdwDynamicParameterValueNeeded => "FdwDynamicParameterValueNeeded",
    FdwFunctionSequenceError => "FdwFunctionSequenceError",
    FdwInconsistentDescriptorInformation => "FdwInconsistentDescriptorInformation",
    FdwInvalidAttributeValue => "FdwInvalidAttributeValue",
    FdwInvalidColumnName => "FdwInvalidColumnName",
    FdwInvalidColumnNumber => "FdwInvalidColumnNumber",
    FdwInvalidDataType => "FdwInvalidDataType",
    FdwInvalidDataTypeDescriptors => "FdwInvalidDataTypeDescriptors",
    FdwInvalidDescriptorFieldIdentifier => "FdwInvalidDescriptorFieldIdentifier",
    FdwInvalidHandle => "FdwInvalidHandle",
    FdwInvalidOptionIndex => "FdwInvalidOptionIndex",
    FdwInvalidOptionName => "FdwInvalidOptionName",
    FdwInvalidStringLengthOrBufferLength => "FdwInvalidStringLengthOrBufferLength",
    FdwInvalidStringFormat => "FdwInvalidStringFormat",
    FdwInvalidUseOfNullPointer => "FdwInvalidUseOfNullPointer",
    FdwTooManyHandles => "FdwTooManyHandles",
    FdwOutOfMemory => "FdwOutOfMemory",
    FdwNoSchemas => "FdwNoSchemas",
    FdwOptionNameNotFound => "FdwOptionNameNotFound",
    FdwReplyHandle => "FdwReplyHandle",
    FdwSchemaNotFound => "FdwSchemaNotFound",
    FdwTableNotFound => "FdwTableNotFound",
    FdwUnableToCreateExecution => "FdwUnableToCreateExecution",
    FdwUnableToCreateReply => "FdwUnableToCreateReply",
    FdwUnableToEstablishConnection => "FdwUnableToEstablishConnection",
    PlpgsqlError => "PlpgsqlError",
    RaiseException => "RaiseException",
    NoDataFound => "NoDataFound",
    TooManyRows => "TooManyRows",
    AssertFailure => "AssertFailure",
    InternalError => "InternalError",
    DataCorrupted => "DataCorrupted",
    IndexCorrupted => "IndexCorrupted",
    UnknownError => "UnknownError",
)
