userver: userver/storages/postgres/sql_state.hpp File Reference
Loading...
Searching...
No Matches
sql_state.hpp File Reference

Detailed Description

PostgreSQL error codes.

Definition in file sql_state.hpp.

Go to the source code of this file.

#include <cstdint>
#include <string_view>
+ This graph shows which files directly or indirectly include this file:

Classes

struct  std::hash<::storages::postgres::SqlState >
 Specialization of std::hash template for SqlState. More...
 

Namespaces

namespace  storages
 Components, clients and helpers for different databases and storages.
 
namespace  storages::postgres
 Top namespace for uPg driver.
 
namespace  std
 STL namespace.
 

Enumerations

enum class  storages::postgres::SqlStateClass : std::int64_t {
  kSuccessfulCompletion = 0x01 ,
  kWarning = 0x02 ,
  kNoData = 0x10 ,
  kSqlStatementNotYetComplete = 0x20 ,
  kConnectionException = 0x40 ,
  kTriggeredActionException = 0x80 ,
  kFeatureNotSupported = 0x100 ,
  kInvalidTransactionInitiation = 0x200 ,
  kLocatorException = 0x400 ,
  kInvalidGrantor = 0x800 ,
  kInvalidRoleSpecification = 0x1000 ,
  kDiagnosticsException = 0x2000 ,
  kCaseNotFound = 0x4000 ,
  kCardinalityViolation = 0x8000 ,
  kDataException = 0x10000 ,
  kIntegrityConstraintViolation = 0x20000 ,
  kInvalidCursorState = 0x40000 ,
  kInvalidTransactionState = 0x80000 ,
  kInvalidSqlStatementName = 0x100000 ,
  kTriggeredDataChangeViolation = 0x200000 ,
  kInvalidAuthorizationSpecification = 0x400000 ,
  kDependentPrivilegeDescriptorsStillExist = 0x800000 ,
  kInvalidTransactionTermination = 0x1000000 ,
  kSqlRoutineException = 0x2000000 ,
  kInvalidCursorName = 0x4000000 ,
  kExternalRoutineException = 0x8000000 ,
  kExternalRoutineInvocationException = 0x10000000 ,
  kSavepointException = 0x20000000 ,
  kInvalidCatalogName = 0x40000000 ,
  kInvalidSchemaName = 0x80000000 ,
  kTransactionRollback = 0x100000000 ,
  kSyntaxErrorOrAccessRuleViolation = 0x200000000 ,
  kWithCheckOptionViolation = 0x400000000 ,
  kInsufficientResources = 0x800000000 ,
  kProgramLimitExceeded = 0x1000000000 ,
  kObjectNotInPrerequisiteState = 0x2000000000 ,
  kOperatorIntervention = 0x4000000000 ,
  kSystemError = 0x8000000000 ,
  kSnapshotTooOld = 0x10000000000 ,
  kConfigFileError = 0x20000000000 ,
  kFdwError = 0x40000000000 ,
  kPlpgsqlError = 0x80000000000 ,
  kInternalError = 0x100000000000
}
 
enum class  storages::postgres::SqlState : std::int64_t {
  kUnknownState ,
  Class 00 — Successful Completion ,
  storages::postgres::kSuccessfulCompletion = static_cast<std::int64_t>(SqlStateClass::kSuccessfulCompletion) ,
  Class 01 — Warning ,
  storages::postgres::kWarning = static_cast<std::int64_t>(SqlStateClass::kWarning) ,
  storages::postgres::kDynamicResultSetsReturned ,
  storages::postgres::kImplicitZeroBitPadding ,
  storages::postgres::kNullValueEliminatedInSetFunction ,
  storages::postgres::kPrivilegeNotGranted ,
  storages::postgres::kPrivilegeNotRevoked ,
  storages::postgres::kStringDataRightTruncationWarn ,
  storages::postgres::kDeprecatedFeature ,
  Class 02 — No Data(this is also a warning class per the SQL ,
  storages::postgres::kNoData = static_cast<std::int64_t>(SqlStateClass::kNoData) ,
  storages::postgres::kNoAdditionalDynamicResultSetsReturned ,
  Class 03 — SQL Statement Not Yet Complete ,
  storages::postgres::kSqlStatementNotYetComplete = static_cast<std::int64_t>(SqlStateClass::kSqlStatementNotYetComplete) ,
  Class 08 — Connection Exception ,
  storages::postgres::kConnectionException = static_cast<std::int64_t>(SqlStateClass::kConnectionException) ,
  storages::postgres::kConnectionDoesNotExist ,
  storages::postgres::kConnectionFailure ,
  storages::postgres::kSqlclientUnableToEstablishSqlconnection ,
  storages::postgres::kSqlserverRejectedEstablishmentOfSqlconnection ,
  storages::postgres::kTransactionResolutionUnknown ,
  storages::postgres::kProtocolViolation ,
  Class 09 — Triggered Action Exception ,
  storages::postgres::kTriggeredActionException = static_cast<std::int64_t>(SqlStateClass::kTriggeredActionException) ,
  Class 0A — Feature Not Supported ,
  storages::postgres::kFeatureNotSupported = static_cast<std::int64_t>(SqlStateClass::kFeatureNotSupported) ,
  Class 0B — Invalid Transaction Initiation ,
  storages::postgres::kInvalidTransactionInitiation = static_cast<std::int64_t>(SqlStateClass::kInvalidTransactionInitiation) ,
  Class 0F — Locator Exception ,
  storages::postgres::kLocatorException = static_cast<std::int64_t>(SqlStateClass::kLocatorException) ,
  storages::postgres::kInvalidLocatorSpecification ,
  Class 0L — Invalid Grantor ,
  storages::postgres::kInvalidGrantor = static_cast<std::int64_t>(SqlStateClass::kInvalidGrantor) ,
  storages::postgres::kInvalidGrantOperation ,
  Class 0P — Invalid Role Specification ,
  storages::postgres::kInvalidRoleSpecification = static_cast<std::int64_t>(SqlStateClass::kInvalidRoleSpecification) ,
  Class 0Z — Diagnostics Exception ,
  storages::postgres::kDiagnosticsException = static_cast<std::int64_t>(SqlStateClass::kDiagnosticsException) ,
  storages::postgres::kStackedDiagnosticsAccessedWithoutActiveHandler ,
  Class 20 — Case Not Found ,
  storages::postgres::kCaseNotFound = static_cast<std::int64_t>(SqlStateClass::kCaseNotFound) ,
  Class 21 — Cardinality Violation ,
  storages::postgres::kCardinalityViolation = static_cast<std::int64_t>(SqlStateClass::kCardinalityViolation) ,
  Class 22 — Data Exception ,
  storages::postgres::kDataException = static_cast<std::int64_t>(SqlStateClass::kDataException) ,
  storages::postgres::kArraySubscriptError ,
  storages::postgres::kCharacterNotInRepertoire ,
  storages::postgres::kDatetimeFieldOverflow ,
  storages::postgres::kDivisionByZero ,
  storages::postgres::kErrorInAssignment ,
  storages::postgres::kEscapeCharacterConflict ,
  storages::postgres::kIndicatorOverflow ,
  storages::postgres::kIntervalFieldOverflow ,
  storages::postgres::kInvalidArgumentForLogarithm ,
  storages::postgres::kInvalidArgumentForNtileFunction ,
  storages::postgres::kInvalidArgumentForNthValueFunction ,
  storages::postgres::kInvalidArgumentForPowerFunction ,
  storages::postgres::kInvalidArgumentForWidthBucketFunction ,
  storages::postgres::kInvalidCharacterValueForCast ,
  storages::postgres::kInvalidDatetimeFormat ,
  storages::postgres::kInvalidEscapeCharacter ,
  storages::postgres::kInvalidEscapeOctet ,
  storages::postgres::kInvalidEscapeSequence ,
  storages::postgres::kNonstandardUseOfEscapeCharacter ,
  storages::postgres::kInvalidIndicatorParameterValue ,
  storages::postgres::kInvalidParameterValue ,
  storages::postgres::kInvalidPrecedingOrFollowingSize ,
  storages::postgres::kInvalidRegularExpression ,
  storages::postgres::kInvalidRowCountInLimitClause ,
  storages::postgres::kInvalidRowCountInResultOffsetClause ,
  storages::postgres::kInvalidTablesampleArgument ,
  storages::postgres::kInvalidTablesampleRepeat ,
  storages::postgres::kInvalidTimeZoneDisplacementValue ,
  storages::postgres::kInvalidUseOfEscapeCharacter ,
  storages::postgres::kMostSpecificTypeMismatch ,
  storages::postgres::kNullValueNotAllowed ,
  storages::postgres::kNullValueNoIndicatorParameter ,
  storages::postgres::kNumericValueOutOfRange ,
  storages::postgres::kSequenceGeneratorLimitExceeded ,
  storages::postgres::kStringDataLengthMismatch ,
  storages::postgres::kStringDataRightTruncation ,
  storages::postgres::kSubstringError ,
  storages::postgres::kTrimError ,
  storages::postgres::kUnterminatedCString ,
  storages::postgres::kZeroLengthCharacterString ,
  storages::postgres::kFloatingPointException ,
  storages::postgres::kInvalidTextRepresentation ,
  storages::postgres::kInvalidBinaryRepresentation ,
  storages::postgres::kBadCopyFileFormat ,
  storages::postgres::kUntranslatableCharacter ,
  storages::postgres::kNotAnXmlDocument ,
  storages::postgres::kInvalidXmlDocument ,
  storages::postgres::kInvalidXmlContent ,
  storages::postgres::kInvalidXmlComment ,
  storages::postgres::kInvalidXmlProcessingInstruction ,
  storages::postgres::kDuplicateJsonObjectKeyValue ,
  storages::postgres::kInvalidJsonText ,
  storages::postgres::kInvalidSqlJsonSubscript ,
  storages::postgres::kMoreThanOneSqlJsonItem ,
  storages::postgres::kNoSqlJsonItem ,
  storages::postgres::kNonNumericSqlJsonItem ,
  storages::postgres::kNonUniqueKeysInAJsonObject ,
  storages::postgres::kSingletonSqlJsonItemRequired ,
  storages::postgres::kSqlJsonArrayNotFound ,
  storages::postgres::kSqlJsonMemberNotFound ,
  storages::postgres::kSqlJsonNumberNotFound ,
  storages::postgres::kSqlJsonObjectNotFound ,
  storages::postgres::kTooManyJsonArrayElements ,
  storages::postgres::kTooManyJsonObjectMembers ,
  storages::postgres::kSqlJsonScalarRequired ,
  Class 23 — Integrity Constraint Violation ,
  storages::postgres::kIntegrityConstraintViolation = static_cast<std::int64_t>(SqlStateClass::kIntegrityConstraintViolation) ,
  storages::postgres::kRestrictViolation ,
  storages::postgres::kNotNullViolation ,
  storages::postgres::kForeignKeyViolation ,
  storages::postgres::kUniqueViolation ,
  storages::postgres::kCheckViolation ,
  storages::postgres::kExclusionViolation ,
  Class 24 — Invalid Cursor State ,
  storages::postgres::kInvalidCursorState = static_cast<std::int64_t>(SqlStateClass::kInvalidCursorState) ,
  Class 25 — Invalid Transaction State ,
  storages::postgres::kInvalidTransactionState = static_cast<std::int64_t>(SqlStateClass::kInvalidTransactionState) ,
  storages::postgres::kActiveSqlTransaction ,
  storages::postgres::kBranchTransactionAlreadyActive ,
  storages::postgres::kHeldCursorRequiresSameIsolationLevel ,
  storages::postgres::kInappropriateAccessModeForBranchTransaction ,
  storages::postgres::kInappropriateIsolationLevelForBranchTransaction ,
  storages::postgres::kNoActiveSqlTransactionForBranchTransaction ,
  storages::postgres::kReadOnlySqlTransaction ,
  storages::postgres::kSchemaAndDataStatementMixingNotSupported ,
  storages::postgres::kNoActiveSqlTransaction ,
  storages::postgres::kInFailedSqlTransaction ,
  storages::postgres::kIdleInTransactionSessionTimeout ,
  Class 26 — Invalid SQL Statement Name ,
  storages::postgres::kInvalidSqlStatementName = static_cast<std::int64_t>(SqlStateClass::kInvalidSqlStatementName) ,
  Class 27 — Triggered Data Change Violation ,
  storages::postgres::kTriggeredDataChangeViolation = static_cast<std::int64_t>(SqlStateClass::kTriggeredDataChangeViolation) ,
  Class 28 — Invalid Authorization Specification ,
  storages::postgres::kInvalidAuthorizationSpecification ,
  storages::postgres::kInvalidPassword ,
  Class 2B — Dependent Privilege Descriptors Still Exist ,
  storages::postgres::kDependentPrivilegeDescriptorsStillExist ,
  storages::postgres::kDependentObjectsStillExist ,
  Class 2D — Invalid Transaction Termination ,
  storages::postgres::kInvalidTransactionTermination ,
  Class 2F — SQL Routine Exception ,
  storages::postgres::kSqlRoutineException = static_cast<std::int64_t>(SqlStateClass::kSqlRoutineException) ,
  storages::postgres::kFunctionExecutedNoReturnStatement ,
  storages::postgres::kModifyingSqlDataNotPermitted ,
  storages::postgres::kProhibitedSqlStatementAttempted ,
  storages::postgres::kReadingSqlDataNotPermitted ,
  Class 34 — Invalid Cursor Name ,
  storages::postgres::kInvalidCursorName = static_cast<std::int64_t>(SqlStateClass::kInvalidCursorName) ,
  Class 38 — External Routine Exception ,
  storages::postgres::kExternalRoutineException = static_cast<std::int64_t>(SqlStateClass::kExternalRoutineException) ,
  storages::postgres::kContainingSqlNotPermitted ,
  storages::postgres::kModifyingSqlDataNotPermittedEx ,
  storages::postgres::kProhibitedSqlStatementAttemptedEx ,
  storages::postgres::kReadingSqlDataNotPermittedEx ,
  Class 39 — External Routine Invocation Exception ,
  storages::postgres::kExternalRoutineInvocationException ,
  storages::postgres::kInvalidSqlstateReturned ,
  storages::postgres::kNullValueNotAllowedEx ,
  storages::postgres::kTriggerProtocolViolated ,
  storages::postgres::kSrfProtocolViolated ,
  storages::postgres::kEventTriggerProtocolViolated ,
  Class 3B — Savepoint Exception ,
  storages::postgres::kSavepointException = static_cast<std::int64_t>(SqlStateClass::kSavepointException) ,
  storages::postgres::kInvalidSavepointSpecification ,
  Class 3D — Invalid Catalog Name ,
  storages::postgres::kInvalidCatalogName = static_cast<std::int64_t>(SqlStateClass::kInvalidCatalogName) ,
  Class 3F — Invalid Schema Name ,
  storages::postgres::kInvalidSchemaName = static_cast<std::int64_t>(SqlStateClass::kInvalidSchemaName) ,
  Class 40 — Transaction Rollback ,
  storages::postgres::kTransactionRollback = static_cast<std::int64_t>(SqlStateClass::kTransactionRollback) ,
  storages::postgres::kTransactionIntegrityConstraintViolation ,
  storages::postgres::kSerializationFailure ,
  storages::postgres::kStatementCompletionUnknown ,
  storages::postgres::kDeadlockDetected ,
  Class 42 — Syntax Error or Access Rule Violation ,
  storages::postgres::kSyntaxErrorOrAccessRuleViolation ,
  storages::postgres::kSyntaxError ,
  storages::postgres::kInsufficientPrivilege ,
  storages::postgres::kCannotCoerce ,
  storages::postgres::kGroupingError ,
  storages::postgres::kWindowingError ,
  storages::postgres::kInvalidRecursion ,
  storages::postgres::kInvalidForeignKey ,
  storages::postgres::kInvalidName ,
  storages::postgres::kNameTooLong ,
  storages::postgres::kReservedName ,
  storages::postgres::kDatatypeMismatch ,
  storages::postgres::kIndeterminateDatatype ,
  storages::postgres::kCollationMismatch ,
  storages::postgres::kIndeterminateCollation ,
  storages::postgres::kWrongObjectType ,
  storages::postgres::kGeneratedAlways ,
  storages::postgres::kUndefinedColumn ,
  storages::postgres::kUndefinedFunction ,
  storages::postgres::kUndefinedTable ,
  storages::postgres::kUndefinedParameter ,
  storages::postgres::kUndefinedObject ,
  storages::postgres::kDuplicateColumn ,
  storages::postgres::kDuplicateCursor ,
  storages::postgres::kDuplicateDatabase ,
  storages::postgres::kDuplicateFunction ,
  storages::postgres::kDuplicatePreparedStatement ,
  storages::postgres::kDuplicateSchema ,
  storages::postgres::kDuplicateTable ,
  storages::postgres::kDuplicateAlias ,
  storages::postgres::kDuplicateObject ,
  storages::postgres::kAmbiguousColumn ,
  storages::postgres::kAmbiguousFunction ,
  storages::postgres::kAmbiguousParameter ,
  storages::postgres::kAmbiguousAlias ,
  storages::postgres::kInvalidColumnReference ,
  storages::postgres::kInvalidColumnDefinition ,
  storages::postgres::kInvalidCursorDefinition ,
  storages::postgres::kInvalidDatabaseDefinition ,
  storages::postgres::kInvalidFunctionDefinition ,
  storages::postgres::kInvalidPreparedStatementDefinition ,
  storages::postgres::kInvalidSchemaDefinition ,
  storages::postgres::kInvalidTableDefinition ,
  storages::postgres::kInvalidObjectDefinition ,
  Class 44 — WITH CHECK OPTION Violation ,
  storages::postgres::kWithCheckOptionViolation = static_cast<std::int64_t>(SqlStateClass::kWithCheckOptionViolation) ,
  Class 53 — Insufficient Resources ,
  storages::postgres::kInsufficientResources = static_cast<std::int64_t>(SqlStateClass::kInsufficientResources) ,
  storages::postgres::kDiskFull ,
  storages::postgres::kOutOfMemory ,
  storages::postgres::kTooManyConnections ,
  storages::postgres::kConfigurationLimitExceeded ,
  Class 54 — Program Limit Exceeded ,
  storages::postgres::kProgramLimitExceeded = static_cast<std::int64_t>(SqlStateClass::kProgramLimitExceeded) ,
  storages::postgres::kStatementTooComplex ,
  storages::postgres::kTooManyColumns ,
  storages::postgres::kTooManyArguments ,
  Class 55 — Object Not In Prerequisite State ,
  storages::postgres::kObjectNotInPrerequisiteState = static_cast<std::int64_t>(SqlStateClass::kObjectNotInPrerequisiteState) ,
  storages::postgres::kObjectInUse ,
  storages::postgres::kCantChangeRuntimeParam ,
  storages::postgres::kLockNotAvailable ,
  storages::postgres::kUnsafeNewEnumValueUsage ,
  Class 57 — Operator Intervention ,
  storages::postgres::kOperatorIntervention = static_cast<std::int64_t>(SqlStateClass::kOperatorIntervention) ,
  storages::postgres::kQueryCancelled ,
  storages::postgres::kAdminShutdown ,
  storages::postgres::kCrashShutdown ,
  storages::postgres::kCannotConnectNow ,
  storages::postgres::kDatabaseDropped ,
  Class 58 — System Error(errors external to Postgres itself) ,
  storages::postgres::kSystemError = static_cast<std::int64_t>(SqlStateClass::kSystemError) ,
  storages::postgres::kIoError ,
  storages::postgres::kUndefinedFile ,
  storages::postgres::kDuplicateFile ,
  Class 72 — Snapshot Failure ,
  storages::postgres::kSnapshotTooOld = static_cast<std::int64_t>(SqlStateClass::kSnapshotTooOld) ,
  Class F0 — Configuration File Error ,
  storages::postgres::kConfigFileError = static_cast<std::int64_t>(SqlStateClass::kConfigFileError) ,
  storages::postgres::kLockFileExists ,
  Class HV — Foreign Data Wrapper Error(SQL/MED) ,
  storages::postgres::kFdwError = static_cast<std::int64_t>(SqlStateClass::kFdwError) ,
  storages::postgres::kFdwColumnNameNotFound ,
  storages::postgres::kFdwDynamicParameterValueNeeded ,
  storages::postgres::kFdwFunctionSequenceError ,
  storages::postgres::kFdwInconsistentDescriptorInformation ,
  storages::postgres::kFdwInvalidAttributeValue ,
  storages::postgres::kFdwInvalidColumnName ,
  storages::postgres::kFdwInvalidColumnNumber ,
  storages::postgres::kFdwInvalidDataType ,
  storages::postgres::kFdwInvalidDataTypeDescriptors ,
  storages::postgres::kFdwInvalidDescriptorFieldIdentifier ,
  storages::postgres::kFdwInvalidHandle ,
  storages::postgres::kFdwInvalidOptionIndex ,
  storages::postgres::kFdwInvalidOptionName ,
  storages::postgres::kFdwInvalidStringLengthOrBufferLength ,
  storages::postgres::kFdwInvalidStringFormat ,
  storages::postgres::kFdwInvalidUseOfNullPointer ,
  storages::postgres::kFdwTooManyHandles ,
  storages::postgres::kFdwOutOfMemory ,
  storages::postgres::kFdwNoSchemas ,
  storages::postgres::kFdwOptionNameNotFound ,
  storages::postgres::kFdwReplyHandle ,
  storages::postgres::kFdwSchemaNotFound ,
  storages::postgres::kFdwTableNotFound ,
  storages::postgres::kFdwUnableToCreateExecution ,
  storages::postgres::kFdwUnableToCreateReply ,
  storages::postgres::kFdwUnableToEstablishConnection ,
  Class P0 — PL/pgSQL Error ,
  storages::postgres::kPlpgsqlError = static_cast<std::int64_t>(SqlStateClass::kPlpgsqlError) ,
  storages::postgres::kRaiseException ,
  storages::postgres::kNoDataFound ,
  storages::postgres::kTooManyRows ,
  storages::postgres::kAssertFailure ,
  Class XX — Internal Error ,
  storages::postgres::kInternalError = static_cast<std::int64_t>(SqlStateClass::kInternalError) ,
  storages::postgres::kDataCorrupted ,
  storages::postgres::kIndexCorrupted
}
 

Functions

SqlStateClass storages::postgres::GetSqlStateClass (SqlState)
 
SqlState storages::postgres::SqlStateFromString (std::string_view)
 
bool storages::postgres::IsWhitelistedState (SqlState)