userver: storages::postgres Namespace Reference
Loading...
Searching...
No Matches
storages::postgres Namespace Reference

Detailed Description

Top namespace for uPg driver.

For more information see uPg Driver

Namespaces

namespace  io
 uPg input-output.
 

Classes

class  AccessRuleViolation
 
class  AdminShutdown
 
class  AlreadyInTransaction
 
class  ArrayError
 Base error when working with array types. More...
 
class  BitStringError
 Base error when working with bit string types. More...
 
class  BitStringOverflow
 Value in PostgreSQL binary buffer cannot be represented by a given C++ type. More...
 
struct  BitStringWrapper
 
class  BoundedRange
 
class  BoundedRangeError
 PostgreSQL range type has at least one end unbound. More...
 
struct  ByteaWrapper
 Wrapper for binary data container. More...
 
class  CannotConnectNow
 
class  CardinalityViolation
 
class  CheckViolation
 
class  Cluster
 Interface for executing queries on a cluster of PostgreSQL servers. More...
 
class  ClusterError
 
struct  ClusterHostTypeHash
 
struct  ClusterSettings
 Settings for storages::postgres::Cluster. More...
 
struct  ClusterStatistics
 Cluster statistics storage. More...
 
class  ClusterUnavailable
 
struct  CommandControl
 
class  CommandError
 Error when invoking a libpq function. More...
 
struct  CompositeFieldDef
 Description of a field in a user-defined composite type, for type checking. More...
 
class  CompositeMemberTypeMismatch
 PostgreSQL composite type has different member type that the C++ mapping suggests. More...
 
class  CompositeSizeMismatch
 PostgreSQL composite type has different count of members from the C++ counterpart. More...
 
class  CompositeTypeDescription
 PostgreSQL composite type description. More...
 
class  ConfigurationFileError
 
class  ConnectionBusy
 An attempt to make a query to server was made while there is another query in flight. More...
 
class  ConnectionError
 
class  ConnectionFailed
 Exception is thrown when a single connection fails to connect. More...
 
class  ConnectionInterrupted
 A network operation was interrupted by task cancellation. More...
 
struct  ConnectionSettings
 
struct  ConnectionStatistics
 Template connection statistics storage. More...
 
class  ConnectionTimeoutError
 A network operation on a connection has timed out. More...
 
class  ConstFieldIterator
 Iterator over fields in a result set's row. More...
 
class  ConstRowIterator
 
class  CrashShutdown
 
class  Database
 Object for accessing PostgreSQL database instance (sharded or not) More...
 
class  DatabaseDropped
 
class  DataException
 Base class for data exceptions Doc: https://www.postgresql.org/docs/12/static/errcodes-appendix.html. More...
 
struct  DBTypeDescription
 Description of a PostgreSQL type. The structure is selected from the pg_catalog.pg_type table (not all, only appropriate fields). See https://www.postgresql.org/docs/12/catalog-pg-type.html. More...
 
struct  DBTypeName
 Identity for a PostgreSQL type name. More...
 
class  DependentPrivilegeDescriptorsStillExist
 
class  DiagnosticsException
 
class  DimensionMismatch
 Array received from postgres has different dimensions from those of C++ container. More...
 
class  DistLockComponentBase
 Base class for postgres-based distlock worker components. More...
 
class  DistLockStrategy
 Postgres distributed locking strategy. More...
 
struct  DsnOptions
 
class  DuplicatePreparedStatement
 
class  EnumerationError
 
class  Error
 Base class for all exceptions that may be thrown by the driver. More...
 
class  ExclusionViolation
 
class  ExternalRoutineException
 
class  ExternalRoutineInvocationException
 
class  FdwError
 
class  FeatureNotSupported
 
class  Field
 Accessor to a single field in a result set's row. More...
 
struct  FieldDescription
 
class  FieldIndexOutOfBounds
 Result set has less columns that the requested index. More...
 
class  FieldNameDoesntExist
 Result set doesn't have field with the requested name. More...
 
struct  FieldTag
 Tag type to disambiguate reading the first value of a row to a user's composite type (PostgreSQL composite type in the row initializes user's type). More...
 
class  FieldTupleMismatch
 A row was requested to be parsed based on field names/indexed, the count of names/indexes doesn't match the tuple size. More...
 
class  FieldValueIsNull
 Data extraction from a null field value to a non-nullable type requested. More...
 
class  FieldView
 
class  ForeignKeyViolation
 
struct  InstanceStatisticsNonatomic
 
struct  InstanceStatisticsTemplate
 Template instance statistics storage. More...
 
struct  InstanceStatsDescriptor
 Instance statistics with description. More...
 
struct  InstanceTopologyStatistics
 Template instance topology statistics storage. More...
 
class  InsufficientResources
 
class  IntegrityConstraintViolation
 Base class for integrity constraint violation errors. Doc: https://www.postgresql.org/docs/12/static/errcodes-appendix.html. More...
 
class  InternalServerError
 
class  InvalidAuthorizationSpecification
 
class  InvalidBinaryBuffer
 Binary buffer contains invalid data. Can occur when parsing binary buffers containing multiple fields. More...
 
class  InvalidBitStringRepresentation
 Value in PostgreSQL binary buffer cannot be represented as bit string type. More...
 
class  InvalidConfig
 
class  InvalidCursorState
 
class  InvalidDimensions
 
class  InvalidDSN
 
class  InvalidEnumerationLiteral
 
class  InvalidEnumerationValue
 
class  InvalidGrantor
 
class  InvalidInputBufferSize
 Buffer size is invalid for a fixed-size type. Can occur when a wrong field type is requested for reply. More...
 
class  InvalidInputFormat
 Invalid format for input data. More...
 
class  InvalidObjectName
 Exception class for several Invalid * Name classes. Class 34 - Invalid Cursor Name Class 3D - Invalid Catalogue Name Class 3F - Invalid Schema Name TODO Add documentation (links) on the error classes TODO Split exception classes if needed based on documentation. More...
 
class  InvalidParserCategory
 Field buffer contains different category of data than expected by data parser. More...
 
class  InvalidRepresentation
 Integral representation for a numeric contains invalid data. More...
 
class  InvalidRoleSpecification
 
class  InvalidSqlStatementName
 This exception is thrown in case a prepared statement doesn't exist. More...
 
class  InvalidTransactionState
 
class  InvalidTransactionTermination
 
class  InvalidTupleSizeRequested
 A tuple was requested to be parsed out of a row that doesn't have enough fields. More...
 
class  IpAddressError
 
class  IpAddressInvalidFormat
 
class  LocatorException
 
class  LogicError
 Base Postgres logic error. Reports errors that are consequences of erroneous driver usage, such as invalid query syntax, absence of appropriate parsers, out of range errors etc. These can be avoided by fixing code. More...
 
class  Message
 
class  NoBinaryParser
 A field in a result set doesn't have a binary parser. More...
 
class  NonSingleColumnResultSet
 A row or result set requested to be treated as a single column, but contains more than one column. More...
 
class  NonSingleRowResultSet
 A result set containing a single row was expected. More...
 
struct  Notification
 
class  NotifyScope
 RAII scope for receiving notifications. More...
 
class  NotImplemented
 
class  NotInTransaction
 
class  NotNullViolation
 
struct  Null
 Type to represent a null value. More...
 
class  NumericError
 
class  NumericOverflow
 Value in PostgreSQL binary buffer cannot be represented by a given C++ type. More...
 
class  ObjectNotInPrerequisiteState
 
class  OperatorIntervention
 
class  ParameterStore
 Class for dynamic PostgreSQL parameter list construction. More...
 
class  PlPgSqlError
 
class  PoolError
 Indicates errors during pool operation. More...
 
struct  PoolSettings
 PostgreSQL connection pool options. More...
 
class  Portal
 
class  ProgramLimitExceeded
 
class  QueryCancelled
 
class  QueryQueue
 A container to enqueue queries in FIFO order and execute them all within a single network round-trip. More...
 
class  Range
 
class  RestrictViolation
 
class  ResultSet
 PostgreSQL result set. More...
 
class  ResultSetError
 
class  ReverseConstFieldIterator
 Reverse iterator over fields in a result set's row. More...
 
class  ReverseConstRowIterator
 
class  Row
 
class  RowDescription
 A wrapper for PGresult to access field descriptions. More...
 
class  RowIndexOutOfBounds
 Result set has less rows than the requested row index. More...
 
struct  RowTag
 Tag type to disambiguate reading the row to a user's row type (values of the row initialize user's type data members). More...
 
class  RuntimeError
 Base Postgres runtime error. Reports errors that are consequences of erroneous data, misconfiguration, network errors etc. More...
 
class  SavepointException
 
class  ServerConnectionError
 Connection error reported by PostgreSQL server. Doc: https://www.postgresql.org/docs/12/static/errcodes-appendix.html Class 08 - Connection exception. More...
 
class  ServerError
 Error that was reported by PosgtreSQL server Contains the message sent by the server. Templated class because the errors can be both runtime and logic. More...
 
class  SnapshotFailure
 
class  SqlRoutineException
 
class  SqlStatementNotYetComplete
 
struct  StatementMetricsSettings
 PostgreSQL statements metrics options. More...
 
struct  StatementStatistics
 
class  SyntaxError
 
class  SystemError
 
struct  TimePointTz
 Corresponds to TIMESTAMP WITH TIME ZONE database type. More...
 
struct  TimePointWithoutTz
 Corresponds to TIMESTAMP WITHOUT TIME ZONE database type. More...
 
struct  TopologySettings
 
class  Transaction
 PostgreSQL transaction. More...
 
class  TransactionError
 
class  TransactionForceRollback
 
struct  TransactionOptions
 PostgreSQL transaction options. More...
 
class  TransactionRollback
 
struct  TransactionStatistics
 Template transaction statistics storage. More...
 
class  TriggeredActionException
 
class  TriggeredDataChangeViolation
 Class 27 - Triggered Data Change Violation. More...
 
class  TypeCannotBeNull
 A value of a non-nullable type requested to be set null. Can occur if io::traits::IsNullable for the type is specialised as true_type, but io::traits::GetSetNull is not specialized appropriately. More...
 
class  TypedResultSet
 
struct  UnboundedType
 
class  UniqueViolation
 
class  UnknownBufferCategory
 While checking result set types, failed to determine the buffer category for a type oid. The context string is formed by the ResultSet and will have the form of 'result set field foo type my_schema.bar field baz array element'. More...
 
class  UnsupportedInterval
 
class  UserTypeError
 Base error when working with mapped types. More...
 
class  UserTypes
 Container for connection-specific user data types. More...
 
class  ValueIsNaN
 
class  WithCheckOptionViolation
 Class 44 - WITH CHECK OPTION Violation. More...
 

Typedefs

using ClusterHostTypeFlags = ::utils::Flags<ClusterHostType>
 
using DatabasePtr = std::shared_ptr<Database>
 
using Dsn = ::utils::NonLoggable<class DsnTag, std::string>
 
using DsnList = std::vector<Dsn>
 
template<unsigned Precision = 50>
using MultiPrecision = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Precision>>
 
using ClockType = std::chrono::system_clock
 
using TimePoint = ClockType::time_point
 
using IntervalType = std::chrono::microseconds
 
using Date = ::utils::datetime::Date
 Corresponds to DATE.
 
using NetworkV4 = ::utils::ip::NetworkV4
 
using AddressV4 = ::utils::ip::AddressV4
 
using NetworkV6 = ::utils::ip::NetworkV6
 
using AddressV6 = ::utils::ip::AddressV6
 
using InetNetwork = ::utils::ip::InetNetwork
 
using PlainJson
 
using Macaddr = ::utils::Macaddr
 
using Macaddr8 = ::utils::Macaddr8
 
using Oid = unsigned int
 PostgreSQL Oid type.
 
using RangeBounds = ::utils::Flags<RangeBound>
 
using IntegerRange = Range<Integer>
 
using BigintRange = Range<Bigint>
 
using BoundedIntegerRange = BoundedRange<Integer>
 
using BoundedBigintRange = BoundedRange<Bigint>
 
using OptionalCommandControl = std::optional<CommandControl>
 storages::postgres::CommandControl that may not be set
 
using CommandControlByMethodMap = ::utils::impl::TransparentMap<std::string, CommandControl>
 
using CommandControlByHandlerMap
 
using CommandControlByQueryMap = std::unordered_map<std::string, CommandControl>
 
using PortalName = ::utils::StrongTypedef<struct PortalNameTag, std::string>
 
using ClusterPtr = std::shared_ptr<Cluster>
 Smart pointer to the storages::postgres::Cluster.
 
using TimeoutDuration = std::chrono::milliseconds
 
using Query = ::storages::Query
 
using RateCounter = ::utils::statistics::RateCounter
 
using Percentile = ::utils::statistics::Percentile<2048>
 
using MinMaxAvg = ::utils::statistics::MinMaxAvg<uint32_t>
 
using InstanceStatistics
 
using InstanceStatisticsNonatomicBase = InstanceStatisticsTemplate<uint32_t, Percentile, MinMaxAvg>
 
using ClusterStatisticsPtr = std::unique_ptr<ClusterStatistics>
 
Generic driver errors
using ServerLogicError = ServerError<LogicError>
 
using ServerRuntimeError = ServerError<RuntimeError>
 

Enumerations

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

Functions

std::string ToString (ClusterHostType)
 
std::string ToString (ClusterHostTypeFlags)
 
logging::LogHelperoperator<< (logging::LogHelper &, ClusterHostType)
 
logging::LogHelperoperator<< (logging::LogHelper &, ClusterHostTypeFlags)
 
DsnList SplitByHost (const Dsn &dsn)
 
std::string MakeDsnNick (const Dsn &dsn, bool escape)
 
DsnOptions OptionsFromDsn (const Dsn &dsn)
 
std::string GetHostPort (const Dsn &dsn)
 Return <host>[:<port>] string for a single-host DSN.
 
std::string DsnCutPassword (const Dsn &dsn)
 Return DSN string without 'password' field.
 
std::string DsnMaskPassword (const Dsn &dsn)
 Return DSN string with password contents masked.
 
std::string EscapeHostName (const std::string &hostname, char escape_char='_')
 
Dsn ResolveDsnHostaddrs (const Dsn &dsn, clients::dns::Resolver &resolver, engine::Deadline deadline)
 
template<BitStringType kBitStringType, typename BitContainer >
constexpr detail::BitStringRefWrapper< const BitContainer &, detail::BitContainerInterface::kCommon, kBitStringType > BitString (const BitContainer &bits)
 
template<BitStringType kBitStringType, typename BitContainer >
constexpr detail::BitStringRefWrapper< BitContainer &, detail::BitContainerInterface::kCommon, kBitStringType > BitString (BitContainer &bits)
 
template<BitStringType kBitStringType, typename Enum >
constexpr detail::BitStringRefWrapper< const ::utils::Flags< Enum > &, detail::BitContainerInterface::kFlags, kBitStringType > BitString (const ::utils::Flags< Enum > &bits)
 
template<BitStringType kBitStringType, typename Enum >
constexpr detail::BitStringRefWrapper<::utils::Flags< Enum > &, detail::BitContainerInterface::kFlags, kBitStringType > BitString (::utils::Flags< Enum > &bits)
 
template<typename BitContainer >
constexpr auto Varbit (BitContainer &&bits)
 
template<typename BitContainer >
constexpr auto Bit (BitContainer &&bits)
 
template<typename ByteContainer >
detail::ByteaRefWrapper< const ByteContainer & > Bytea (const ByteContainer &bytes)
 
template<typename ByteContainer >
detail::ByteaRefWrapper< ByteContainer & > Bytea (ByteContainer &bytes)
 
logging::LogHelperoperator<< (logging::LogHelper &, TimePointTz)
 Logging support for TimePointTz.
 
std::ostream & operator<< (std::ostream &, TimePointTz)
 gtest logging support for TimePointTz.
 
logging::LogHelperoperator<< (logging::LogHelper &, TimePointWithoutTz)
 Logging support for TimePointWithoutTz.
 
std::ostream & operator<< (std::ostream &, TimePointWithoutTz)
 gtest logging support for TimePointWithoutTz.
 
TimePointTz Now ()
 Mockable now that is written as TIMESTAMP WITH TIME ZONE.
 
TimePointWithoutTz NowWithoutTz ()
 Mockable now that is written as TIMESTAMP WITHOUT TIME ZONE.
 
TimePoint PostgresEpochTimePoint ()
 Postgres epoch timestamp (2000-01-01 00:00 UTC)
 
Date PostgresEpochDate ()
 Postgres epoch date (2000-01-01)
 
template<typename T >
auto MakeRange (T &&lower, T &&upper, RangeBounds bounds=RangeBound::kLower)
 
template<typename T >
auto MakeRange (T &&lower, UnboundedType, RangeBounds bounds=RangeBound::kLower)
 
template<typename T >
auto MakeRange (UnboundedType, T &&upper, RangeBounds bounds=RangeBound::kNone)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Range< T > &val)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const BoundedRange< T > &val)
 
void LogRegisteredTypesOnce ()
 
std::ostream & operator<< (std::ostream &, IsolationLevel)
 
constexpr bool operator== (const TransactionOptions &lhs, const TransactionOptions &rhs)
 
const std::string & BeginStatement (const TransactionOptions &)
 
OptionalCommandControl GetHandlerOptionalCommandControl (const CommandControlByHandlerMap &map, std::string_view path, std::string_view method)
 
OptionalCommandControl GetQueryOptionalCommandControl (const CommandControlByQueryMap &map, const std::string &query_name)
 
SqlStateClass GetSqlStateClass (SqlState)
 
SqlState SqlStateFromString (std::string_view)
 
bool IsWhitelistedState (SqlState)
 
void DumpMetric (::utils::statistics::Writer &writer, const InstanceStatisticsNonatomic &stats)
 
void DumpMetric (::utils::statistics::Writer &writer, const InstanceStatsDescriptor &value)
 InstanceStatsDescriptor values support for utils::statistics::Writer.
 
void DumpMetric (::utils::statistics::Writer &writer, const ClusterStatistics &value)
 ClusterStatistics values support for utils::statistics::Writer.
 
void Write (dump::Writer &writer, const TimePointTz &value)
 Cache dumps support for storages::postgres::TimePointTz.
 
TimePointTz Read (dump::Reader &reader, dump::To< TimePointTz >)
 
void Write (dump::Writer &writer, const TimePointWithoutTz &value)
 Cache dumps support for storages::postgres::TimePointWithoutTz.
 
TimePointWithoutTz Read (dump::Reader &reader, dump::To< TimePointWithoutTz >)
 

Variables

constexpr ClusterHostTypeFlags kClusterHostRolesMask
 
constexpr ClusterHostTypeFlags kClusterHostStrategyMask {ClusterHostType::kRoundRobin, ClusterHostType::kNearest}
 
constexpr TimePoint kTimestampPositiveInfinity = TimePoint::max()
 
constexpr TimePoint kTimestampNegativeInfinity = TimePoint::min()
 
constexpr Date kDatePositiveInfinity = Date::SysDays::max()
 
constexpr Date kDateNegativeInfinity = Date::SysDays::min()
 
constexpr Oid kInvalidOid = 0
 
constexpr UnboundedType kUnbounded {}
 
constexpr RowTag kRowTag {}
 
constexpr FieldTag kFieldTag {}
 
template<typename T >
constexpr Null< T > null {}
 Template variable to use with query parameters.
 
constexpr std::size_t kDefaultPoolMinSize = 4
 Default initial pool connection count.
 
constexpr auto kDefaultMaxReplicationLag = std::chrono::seconds{60}
 Default maximum replication lag.
 
constexpr std::size_t kDefaultPoolMaxSize = 15
 Default pool connections limit.
 
constexpr std::size_t kDefaultPoolMaxQueueSize = 200
 Default size of queue for clients waiting for connections.
 
constexpr std::size_t kDefaultConnectingLimit = 0
 Default limit for concurrent establishing connections number.
 
constexpr std::size_t kDefaultMaxPreparedCacheSize = 200
 Default size limit for prepared statements cache.
 

Type aliases for integral types

using Smallint = std::int16_t
 
using Integer = std::int32_t
 
using Bigint = std::int64_t
 
using Float4 = float
 
using Float8 = double
 
std::string ToString (DBTypeDescription::TypeClass)
 

Typedef Documentation

◆ AddressV4

Definition at line 24 of file ip.hpp.

◆ AddressV6

Definition at line 28 of file ip.hpp.

◆ Bigint

using storages::postgres::Bigint = std::int64_t

Definition at line 25 of file pg_types.hpp.

◆ BigintRange

Definition at line 199 of file range_types.hpp.

◆ BoundedBigintRange

Definition at line 233 of file range_types.hpp.

◆ BoundedIntegerRange

Definition at line 232 of file range_types.hpp.

◆ ClockType

using storages::postgres::ClockType = std::chrono::system_clock

Definition at line 29 of file chrono.hpp.

◆ ClusterHostTypeFlags

◆ ClusterPtr

using storages::postgres::ClusterPtr = std::shared_ptr<Cluster>

Smart pointer to the storages::postgres::Cluster.

Definition at line 21 of file postgres_fwd.hpp.

◆ ClusterStatisticsPtr

using storages::postgres::ClusterStatisticsPtr = std::unique_ptr<ClusterStatistics>

Definition at line 244 of file statistics.hpp.

◆ CommandControlByHandlerMap

using storages::postgres::CommandControlByHandlerMap
Initial value:
::utils::impl::TransparentMap<std::string, CommandControlByMethodMap>

Definition at line 128 of file options.hpp.

◆ CommandControlByMethodMap

using storages::postgres::CommandControlByMethodMap = ::utils::impl::TransparentMap<std::string, CommandControl>

Definition at line 127 of file options.hpp.

◆ CommandControlByQueryMap

using storages::postgres::CommandControlByQueryMap = std::unordered_map<std::string, CommandControl>

Definition at line 130 of file options.hpp.

◆ DatabasePtr

using storages::postgres::DatabasePtr = std::shared_ptr<Database>

Definition at line 13 of file database_fwd.hpp.

◆ Date

Corresponds to DATE.

Definition at line 20 of file date.hpp.

◆ Dsn

using storages::postgres::Dsn = ::utils::NonLoggable<class DsnTag, std::string>

Definition at line 17 of file dsn.hpp.

◆ DsnList

using storages::postgres::DsnList = std::vector<Dsn>

Definition at line 18 of file dsn.hpp.

◆ Float4

using storages::postgres::Float4 = float

Definition at line 29 of file pg_types.hpp.

◆ Float8

using storages::postgres::Float8 = double

Definition at line 30 of file pg_types.hpp.

◆ InetNetwork

◆ InstanceStatistics

◆ InstanceStatisticsNonatomicBase

◆ Integer

using storages::postgres::Integer = std::int32_t

Definition at line 24 of file pg_types.hpp.

◆ IntegerRange

Definition at line 198 of file range_types.hpp.

◆ IntervalType

using storages::postgres::IntervalType = std::chrono::microseconds

Definition at line 31 of file chrono.hpp.

◆ Macaddr

Definition at line 15 of file macaddr.hpp.

◆ Macaddr8

Definition at line 16 of file macaddr.hpp.

◆ MinMaxAvg

Definition at line 128 of file statistics.hpp.

◆ MultiPrecision

template<unsigned Precision = 50>
using storages::postgres::MultiPrecision = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Precision>>

Definition at line 19 of file boost_multiprecision.hpp.

◆ NetworkV4

Definition at line 21 of file ip.hpp.

◆ NetworkV6

Definition at line 26 of file ip.hpp.

◆ Oid

using storages::postgres::Oid = unsigned int

PostgreSQL Oid type.

Definition at line 18 of file pg_types.hpp.

◆ OptionalCommandControl

storages::postgres::CommandControl that may not be set

Definition at line 125 of file options.hpp.

◆ Percentile

◆ PlainJson

Initial value:

Definition at line 24 of file json_types.hpp.

◆ PortalName

using storages::postgres::PortalName = ::utils::StrongTypedef<struct PortalNameTag, std::string>

Definition at line 22 of file portal.hpp.

◆ Query

Definition at line 9 of file query.hpp.

◆ RangeBounds

Definition at line 37 of file range_types.hpp.

◆ RateCounter

◆ ServerLogicError

◆ ServerRuntimeError

◆ Smallint

using storages::postgres::Smallint = std::int16_t

Definition at line 23 of file pg_types.hpp.

◆ TimeoutDuration

using storages::postgres::TimeoutDuration = std::chrono::milliseconds

Definition at line 33 of file postgres_fwd.hpp.

◆ TimePoint

using storages::postgres::TimePoint = ClockType::time_point

Definition at line 30 of file chrono.hpp.

Enumeration Type Documentation

◆ BitStringType

enum class storages::postgres::BitStringType
strong

Definition at line 71 of file bitstring.hpp.

◆ ClusterHostType

Enumerator
kMaster 

Connect to cluster's master. Only this connection may be used for read-write transactions.

kSyncSlave 

Connect to cluster's sync slave. May fallback to master. Can be used only for read only transactions.

Warning
Not available for clusters with quorum commit, prefer kSlave or kMaster.
kSlave 

Connect to one of cluster's slaves. May fallback to master. Can be used only for read only transactions.

kSlaveOrMaster 

Connect to either a master or to a slave, whatever the host selection strategy chooses. Can be used only for read only transactions.

kRoundRobin 

Chooses a host using the round-robin algorithm.

kNearest 

Chooses a host with the lowest RTT.

Definition at line 18 of file cluster_types.hpp.

◆ ConnlimitMode

enum class storages::postgres::ConnlimitMode
strong

Definition at line 278 of file options.hpp.

◆ InitMode

enum class storages::postgres::InitMode
strong

Initialization modes.

Definition at line 273 of file options.hpp.

◆ IsolationLevel

SQL transaction isolation level.

[Isolation levels]

See also
https://www.postgresql.org/docs/current/static/sql-set-transaction.html
Enumerator
kReadCommitted 

READ COMMITTED.

kRepeatableRead 

REPEATABLE READ.

kSerializable 

SERIALIZABLE.

kReadUncommitted 

READ UNCOMMITTED

Warning
In Postgres READ UNCOMMITTED is treated as READ COMMITTED

Definition at line 23 of file options.hpp.

◆ OmitDescribeInExecuteMode

Whether to omit excessive D(escribe) message when executing prepared statements

Dynamic option POSTGRES_OMIT_DESCRIBE_IN_EXECUTE

Definition at line 191 of file options.hpp.

◆ PipelineMode

Pipeline mode configuration

Dynamic option POSTGRES_CONNECTION_PIPELINE_EXPERIMENT

Definition at line 185 of file options.hpp.

◆ RangeBound

enum class storages::postgres::RangeBound
strong

Definition at line 30 of file range_types.hpp.

◆ SqlState

enum class storages::postgres::SqlState : std::int64_t
strong

PostgreSQL error codes Docs: https://www.postgresql.org/docs/12/static/errcodes-appendix.html Enumeration was generated by userver/scripts/postgres/pg_sql_codes.py

Enumerator
kSuccessfulCompletion 

00000

kWarning 

01000

kDynamicResultSetsReturned 

0100C

kImplicitZeroBitPadding 

01008

kNullValueEliminatedInSetFunction 

01003

kPrivilegeNotGranted 

01007

kPrivilegeNotRevoked 

01006

kStringDataRightTruncationWarn 

01004

kDeprecatedFeature 

01P01

kNoData 

02000

kNoAdditionalDynamicResultSetsReturned 

02001

kSqlStatementNotYetComplete 

03000

kConnectionException 

08000

kConnectionDoesNotExist 

08003

kConnectionFailure 

08006

kSqlclientUnableToEstablishSqlconnection 

08001

kSqlserverRejectedEstablishmentOfSqlconnection 

08004

kTransactionResolutionUnknown 

08007

kProtocolViolation 

08P01

kTriggeredActionException 

09000

kFeatureNotSupported 

0A000

kInvalidTransactionInitiation 

0B000

kLocatorException 

0F000

kInvalidLocatorSpecification 

0F001

kInvalidGrantor 

0L000

kInvalidGrantOperation 

0LP01

kInvalidRoleSpecification 

0P000

kDiagnosticsException 

0Z000

kStackedDiagnosticsAccessedWithoutActiveHandler 

0Z002

kCaseNotFound 

20000

kCardinalityViolation 

21000

kDataException 

22000

kArraySubscriptError 

2202E

kCharacterNotInRepertoire 

22021

kDatetimeFieldOverflow 

22008

kDivisionByZero 

22012

kErrorInAssignment 

22005

kEscapeCharacterConflict 

2200B

kIndicatorOverflow 

22022

kIntervalFieldOverflow 

22015

kInvalidArgumentForLogarithm 

2201E

kInvalidArgumentForNtileFunction 

22014

kInvalidArgumentForNthValueFunction 

22016

kInvalidArgumentForPowerFunction 

2201F

kInvalidArgumentForWidthBucketFunction 

2201G

kInvalidCharacterValueForCast 

22018

kInvalidDatetimeFormat 

22007

kInvalidEscapeCharacter 

22019

kInvalidEscapeOctet 

2200D

kInvalidEscapeSequence 

22025

kNonstandardUseOfEscapeCharacter 

22P06

kInvalidIndicatorParameterValue 

22010

kInvalidParameterValue 

22023

kInvalidPrecedingOrFollowingSize 

22013

kInvalidRegularExpression 

2201B

kInvalidRowCountInLimitClause 

2201W

kInvalidRowCountInResultOffsetClause 

2201X

kInvalidTablesampleArgument 

2202H

kInvalidTablesampleRepeat 

2202G

kInvalidTimeZoneDisplacementValue 

22009

kInvalidUseOfEscapeCharacter 

2200C

kMostSpecificTypeMismatch 

2200G

kNullValueNotAllowed 

22004

kNullValueNoIndicatorParameter 

22002

kNumericValueOutOfRange 

22003

kSequenceGeneratorLimitExceeded 

2200H

kStringDataLengthMismatch 

22026

kStringDataRightTruncation 

22001

kSubstringError 

22011

kTrimError 

22027

kUnterminatedCString 

22024

kZeroLengthCharacterString 

2200F

kFloatingPointException 

22P01

kInvalidTextRepresentation 

22P02

kInvalidBinaryRepresentation 

22P03

kBadCopyFileFormat 

22P04

kUntranslatableCharacter 

22P05

kNotAnXmlDocument 

2200L

kInvalidXmlDocument 

2200M

kInvalidXmlContent 

2200N

kInvalidXmlComment 

2200S

kInvalidXmlProcessingInstruction 

2200T

kDuplicateJsonObjectKeyValue 

22030

kInvalidJsonText 

22032

kInvalidSqlJsonSubscript 

22033

kMoreThanOneSqlJsonItem 

22034

kNoSqlJsonItem 

22035

kNonNumericSqlJsonItem 

22036

kNonUniqueKeysInAJsonObject 

22037

kSingletonSqlJsonItemRequired 

22038

kSqlJsonArrayNotFound 

22039

kSqlJsonMemberNotFound 

2203A

kSqlJsonNumberNotFound 

2203B

kSqlJsonObjectNotFound 

2203C

kTooManyJsonArrayElements 

2203D

kTooManyJsonObjectMembers 

2203E

kSqlJsonScalarRequired 

2203F

kIntegrityConstraintViolation 

23000

kRestrictViolation 

23001

kNotNullViolation 

23502

kForeignKeyViolation 

23503

kUniqueViolation 

23505

kCheckViolation 

23514

kExclusionViolation 

23P01

kInvalidCursorState 

24000

kInvalidTransactionState 

25000

kActiveSqlTransaction 

25001

kBranchTransactionAlreadyActive 

25002

kHeldCursorRequiresSameIsolationLevel 

25008

kInappropriateAccessModeForBranchTransaction 

25003

kInappropriateIsolationLevelForBranchTransaction 

25004

kNoActiveSqlTransactionForBranchTransaction 

25005

kReadOnlySqlTransaction 

25006

kSchemaAndDataStatementMixingNotSupported 

25007

kNoActiveSqlTransaction 

25P01

kInFailedSqlTransaction 

25P02

kIdleInTransactionSessionTimeout 

25P03

kInvalidSqlStatementName 

26000

kTriggeredDataChangeViolation 

27000

kInvalidAuthorizationSpecification 

28000

kInvalidPassword 

28P01

kDependentPrivilegeDescriptorsStillExist 

2B000

kDependentObjectsStillExist 

2BP01

kInvalidTransactionTermination 

2D000

kSqlRoutineException 

2F000

kFunctionExecutedNoReturnStatement 

2F005

kModifyingSqlDataNotPermitted 

2F002

kProhibitedSqlStatementAttempted 

2F003

kReadingSqlDataNotPermitted 

2F004

kInvalidCursorName 

34000

kExternalRoutineException 

38000

kContainingSqlNotPermitted 

38001

kModifyingSqlDataNotPermittedEx 

38002

kProhibitedSqlStatementAttemptedEx 

38003

kReadingSqlDataNotPermittedEx 

38004

kExternalRoutineInvocationException 

39000

kInvalidSqlstateReturned 

39001

kNullValueNotAllowedEx 

39004

kTriggerProtocolViolated 

39P01

kSrfProtocolViolated 

39P02

kEventTriggerProtocolViolated 

39P03

kSavepointException 

3B000

kInvalidSavepointSpecification 

3B001

kInvalidCatalogName 

3D000

kInvalidSchemaName 

3F000

kTransactionRollback 

40000

kTransactionIntegrityConstraintViolation 

40002

kSerializationFailure 

40001

kStatementCompletionUnknown 

40003

kDeadlockDetected 

40P01

kSyntaxErrorOrAccessRuleViolation 

42000

kSyntaxError 

42601

kInsufficientPrivilege 

42501

kCannotCoerce 

42846

kGroupingError 

42803

kWindowingError 

42P20

kInvalidRecursion 

42P19

kInvalidForeignKey 

42830

kInvalidName 

42602

kNameTooLong 

42622

kReservedName 

42939

kDatatypeMismatch 

42804

kIndeterminateDatatype 

42P18

kCollationMismatch 

42P21

kIndeterminateCollation 

42P22

kWrongObjectType 

42809

kGeneratedAlways 

428C9

kUndefinedColumn 

42703

kUndefinedFunction 

42883

kUndefinedTable 

42P01

kUndefinedParameter 

42P02

kUndefinedObject 

42704

kDuplicateColumn 

42701

kDuplicateCursor 

42P03

kDuplicateDatabase 

42P04

kDuplicateFunction 

42723

kDuplicatePreparedStatement 

42P05

kDuplicateSchema 

42P06

kDuplicateTable 

42P07

kDuplicateAlias 

42712

kDuplicateObject 

42710

kAmbiguousColumn 

42702

kAmbiguousFunction 

42725

kAmbiguousParameter 

42P08

kAmbiguousAlias 

42P09

kInvalidColumnReference 

42P10

kInvalidColumnDefinition 

42611

kInvalidCursorDefinition 

42P11

kInvalidDatabaseDefinition 

42P12

kInvalidFunctionDefinition 

42P13

kInvalidPreparedStatementDefinition 

42P14

kInvalidSchemaDefinition 

42P15

kInvalidTableDefinition 

42P16

kInvalidObjectDefinition 

42P17

kWithCheckOptionViolation 

44000

kInsufficientResources 

53000

kDiskFull 

53100

kOutOfMemory 

53200

kTooManyConnections 

53300

kConfigurationLimitExceeded 

53400

kProgramLimitExceeded 

54000

kStatementTooComplex 

54001

kTooManyColumns 

54011

kTooManyArguments 

54023

kObjectNotInPrerequisiteState 

55000

kObjectInUse 

55006

kCantChangeRuntimeParam 

55P02

kLockNotAvailable 

55P03

kUnsafeNewEnumValueUsage 

55P04

kOperatorIntervention 

57000

kQueryCancelled 

57014

kAdminShutdown 

57P01

kCrashShutdown 

57P02

kCannotConnectNow 

57P03

kDatabaseDropped 

57P04

kSystemError 

58000

kIoError 

58030

kUndefinedFile 

58P01

kDuplicateFile 

58P02

kSnapshotTooOld 

72000

kConfigFileError 

F0000.

kLockFileExists 

F0001.

kFdwError 

HV000.

kFdwColumnNameNotFound 

HV005.

kFdwDynamicParameterValueNeeded 

HV002.

kFdwFunctionSequenceError 

HV010.

kFdwInconsistentDescriptorInformation 

HV021.

kFdwInvalidAttributeValue 

HV024.

kFdwInvalidColumnName 

HV007.

kFdwInvalidColumnNumber 

HV008.

kFdwInvalidDataType 

HV004.

kFdwInvalidDataTypeDescriptors 

HV006.

kFdwInvalidDescriptorFieldIdentifier 

HV091.

kFdwInvalidHandle 

HV00B.

kFdwInvalidOptionIndex 

HV00C.

kFdwInvalidOptionName 

HV00D.

kFdwInvalidStringLengthOrBufferLength 

HV090.

kFdwInvalidStringFormat 

HV00A.

kFdwInvalidUseOfNullPointer 

HV009.

kFdwTooManyHandles 

HV014.

kFdwOutOfMemory 

HV001.

kFdwNoSchemas 

HV00P.

kFdwOptionNameNotFound 

HV00J.

kFdwReplyHandle 

HV00K.

kFdwSchemaNotFound 

HV00Q.

kFdwTableNotFound 

HV00R.

kFdwUnableToCreateExecution 

HV00L.

kFdwUnableToCreateReply 

HV00M.

kFdwUnableToEstablishConnection 

HV00N.

kPlpgsqlError 

P0000.

kRaiseException 

P0001.

kNoDataFound 

P0002.

kTooManyRows 

P0003.

kAssertFailure 

P0004.

kInternalError 

XX000.

kDataCorrupted 

XX001.

kIndexCorrupted 

XX002.

Definition at line 65 of file sql_state.hpp.

◆ SqlStateClass

enum class storages::postgres::SqlStateClass : std::int64_t
strong

Docs: https://www.postgresql.org/docs/12/static/errcodes-appendix.html Enumeration was generated by userver/scripts/postgres/pg_sql_codes.py

Definition at line 16 of file sql_state.hpp.

Function Documentation

◆ Bit()

template<typename BitContainer >
constexpr auto storages::postgres::Bit ( BitContainer && bits)
constexpr

Definition at line 141 of file bitstring.hpp.

◆ BitString() [1/4]

template<BitStringType kBitStringType, typename Enum >
constexpr detail:: BitStringRefWrapper<::utils::Flags< Enum > &, detail::BitContainerInterface::kFlags, kBitStringType > storages::postgres::BitString ( ::utils::Flags< Enum > & bits)
constexpr

Definition at line 131 of file bitstring.hpp.

◆ BitString() [2/4]

template<BitStringType kBitStringType, typename BitContainer >
constexpr detail::BitStringRefWrapper< BitContainer &, detail::BitContainerInterface::kCommon, kBitStringType > storages::postgres::BitString ( BitContainer & bits)
constexpr

Definition at line 113 of file bitstring.hpp.

◆ BitString() [3/4]

template<BitStringType kBitStringType, typename Enum >
constexpr detail::BitStringRefWrapper< const ::utils::Flags< Enum > &, detail::BitContainerInterface::kFlags, kBitStringType > storages::postgres::BitString ( const ::utils::Flags< Enum > & bits)
constexpr

Definition at line 124 of file bitstring.hpp.

◆ BitString() [4/4]

template<BitStringType kBitStringType, typename BitContainer >
constexpr detail::BitStringRefWrapper< const BitContainer &, detail::BitContainerInterface::kCommon, kBitStringType > storages::postgres::BitString ( const BitContainer & bits)
constexpr

Definition at line 108 of file bitstring.hpp.

◆ Bytea() [1/2]

template<typename ByteContainer >
detail::ByteaRefWrapper< ByteContainer & > storages::postgres::Bytea ( ByteContainer & bytes)

Helper function for reading binary data

Example usage:

pg::ResultSet res = GetConn()->Execute("select 'foobar'::bytea");
std::string s = "foobar"s;
// reading a binary string
std::string received;
res[0][0].To(pg::Bytea(received));
EXPECT_EQ(received, s);
// sending a binary string
std::string s = "\0\xff\x0afoobar"s;
pg::ResultSet res = GetConn()->Execute("select $1", pg::Bytea(s));
// reading a binary string
std::string received;
res[0][0].To(pg::Bytea(received));
EXPECT_EQ(received, s);
// storing a byte vector:
std::vector<std::uint8_t> bin_str{1, 2, 3, 4, 5, 6, 7, 8, 9};
auto res = GetConn()->Execute("select $1", pg::Bytea(bin_str));
// reading a byte vector
std::vector<std::uint8_t> received;
res[0][0].To(pg::Bytea(received));
EXPECT_EQ(received, bin_str);

Definition at line 83 of file bytea.hpp.

◆ Bytea() [2/2]

template<typename ByteContainer >
detail::ByteaRefWrapper< const ByteContainer & > storages::postgres::Bytea ( const ByteContainer & bytes)

Helper function for reading binary data

Example usage:

pg::ResultSet res = GetConn()->Execute("select 'foobar'::bytea");
std::string s = "foobar"s;
// reading a binary string
std::string received;
res[0][0].To(pg::Bytea(received));
EXPECT_EQ(received, s);
// sending a binary string
std::string s = "\0\xff\x0afoobar"s;
pg::ResultSet res = GetConn()->Execute("select $1", pg::Bytea(s));
// reading a binary string
std::string received;
res[0][0].To(pg::Bytea(received));
EXPECT_EQ(received, s);
// storing a byte vector:
std::vector<std::uint8_t> bin_str{1, 2, 3, 4, 5, 6, 7, 8, 9};
auto res = GetConn()->Execute("select $1", pg::Bytea(bin_str));
// reading a byte vector
std::vector<std::uint8_t> received;
res[0][0].To(pg::Bytea(received));
EXPECT_EQ(received, bin_str);

Definition at line 69 of file bytea.hpp.

◆ MakeDsnNick()

std::string storages::postgres::MakeDsnNick ( const Dsn & dsn,
bool escape )

Create a string <user>@<host>:<port>/<dbname> of a single-host DSN or escape all the punctuation with _ for test

◆ MakeRange() [1/3]

template<typename T >
auto storages::postgres::MakeRange ( T && lower,
T && upper,
RangeBounds bounds = RangeBound::kLower )

Definition at line 181 of file range_types.hpp.

◆ MakeRange() [2/3]

template<typename T >
auto storages::postgres::MakeRange ( T && lower,
UnboundedType ,
RangeBounds bounds = RangeBound::kLower )

Definition at line 187 of file range_types.hpp.

◆ MakeRange() [3/3]

template<typename T >
auto storages::postgres::MakeRange ( UnboundedType ,
T && upper,
RangeBounds bounds = RangeBound::kNone )

Definition at line 193 of file range_types.hpp.

◆ Now()

TimePointTz storages::postgres::Now ( )

Mockable now that is written as TIMESTAMP WITH TIME ZONE.

See also
pg_timestamp

◆ NowWithoutTz()

TimePointWithoutTz storages::postgres::NowWithoutTz ( )

Mockable now that is written as TIMESTAMP WITHOUT TIME ZONE.

See also
pg_timestamp

◆ operator<<() [1/3]

std::ostream & storages::postgres::operator<< ( std::ostream & ,
IsolationLevel  )

[Isolation levels]

◆ operator<<() [2/3]

template<typename T >
std::ostream & storages::postgres::operator<< ( std::ostream & os,
const BoundedRange< T > & val )

Definition at line 539 of file range_types.hpp.

◆ operator<<() [3/3]

template<typename T >
std::ostream & storages::postgres::operator<< ( std::ostream & os,
const Range< T > & val )

Definition at line 452 of file range_types.hpp.

◆ operator==()

constexpr bool storages::postgres::operator== ( const TransactionOptions & lhs,
const TransactionOptions & rhs )
inlineconstexpr

Definition at line 75 of file options.hpp.

◆ OptionsFromDsn()

DsnOptions storages::postgres::OptionsFromDsn ( const Dsn & dsn)

Read options from a DSN First unique option is used if found, otherwise default is taken

◆ ResolveDsnHostaddrs()

Dsn storages::postgres::ResolveDsnHostaddrs ( const Dsn & dsn,
clients::dns::Resolver & resolver,
engine::Deadline deadline )

Return DSN string with hosts resolved as hostaddr values If given DSN has no host or already contains hostaddr, does nothing

◆ Varbit()

template<typename BitContainer >
constexpr auto storages::postgres::Varbit ( BitContainer && bits)
constexpr

Definition at line 136 of file bitstring.hpp.

Variable Documentation

◆ kClusterHostRolesMask

constexpr ClusterHostTypeFlags storages::postgres::kClusterHostRolesMask
constexpr
Initial value:
{
ClusterHostType::kMaster,
ClusterHostType::kSyncSlave,
ClusterHostType::kSlave}

Definition at line 52 of file cluster_types.hpp.

◆ kClusterHostStrategyMask

constexpr ClusterHostTypeFlags storages::postgres::kClusterHostStrategyMask {ClusterHostType::kRoundRobin, ClusterHostType::kNearest}
constexpr

Definition at line 57 of file cluster_types.hpp.

◆ kDateNegativeInfinity

constexpr Date storages::postgres::kDateNegativeInfinity = Date::SysDays::min()
inlineconstexpr

Constant equivalent to PostgreSQL '-infinity'::date, a date that is earlier than all other dates. https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-SPECIAL-TABLE

Definition at line 33 of file date.hpp.

◆ kDatePositiveInfinity

constexpr Date storages::postgres::kDatePositiveInfinity = Date::SysDays::max()
inlineconstexpr

Constant equivalent to PostgreSQL 'infinity'::date, a date that is later than all other dates. https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-SPECIAL-TABLE

Definition at line 28 of file date.hpp.

◆ kDefaultConnectingLimit

constexpr std::size_t storages::postgres::kDefaultConnectingLimit = 0
inlineconstexpr

Default limit for concurrent establishing connections number.

Definition at line 151 of file options.hpp.

◆ kDefaultMaxPreparedCacheSize

constexpr std::size_t storages::postgres::kDefaultMaxPreparedCacheSize = 200
inlineconstexpr

Default size limit for prepared statements cache.

Definition at line 180 of file options.hpp.

◆ kDefaultMaxReplicationLag

constexpr auto storages::postgres::kDefaultMaxReplicationLag = std::chrono::seconds{60}
inlineconstexpr

Default maximum replication lag.

Definition at line 142 of file options.hpp.

◆ kDefaultPoolMaxQueueSize

constexpr std::size_t storages::postgres::kDefaultPoolMaxQueueSize = 200
inlineconstexpr

Default size of queue for clients waiting for connections.

Definition at line 148 of file options.hpp.

◆ kDefaultPoolMaxSize

constexpr std::size_t storages::postgres::kDefaultPoolMaxSize = 15
inlineconstexpr

Default pool connections limit.

Definition at line 145 of file options.hpp.

◆ kDefaultPoolMinSize

constexpr std::size_t storages::postgres::kDefaultPoolMinSize = 4
inlineconstexpr

Default initial pool connection count.

Definition at line 139 of file options.hpp.

◆ kFieldTag

constexpr FieldTag storages::postgres::kFieldTag {}
inlineconstexpr

Definition at line 29 of file row_types.hpp.

◆ kInvalidOid

constexpr Oid storages::postgres::kInvalidOid = 0
inlineconstexpr

Definition at line 19 of file pg_types.hpp.

◆ kRowTag

constexpr RowTag storages::postgres::kRowTag {}
inlineconstexpr

Definition at line 28 of file row_types.hpp.

◆ kTimestampNegativeInfinity

constexpr TimePoint storages::postgres::kTimestampNegativeInfinity = TimePoint::min()
inlineconstexpr

Constant equivalent to PostgreSQL '-infinity'::timestamp, a time point that is earlier than all other time points https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-SPECIAL-TABLE

Definition at line 99 of file chrono.hpp.

◆ kTimestampPositiveInfinity

constexpr TimePoint storages::postgres::kTimestampPositiveInfinity = TimePoint::max()
inlineconstexpr

Constant equivalent to PostgreSQL 'infinity'::timestamp, a time point that is later than all other time points https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-SPECIAL-TABLE

Definition at line 95 of file chrono.hpp.

◆ kUnbounded

constexpr UnboundedType storages::postgres::kUnbounded {}
constexpr

Definition at line 28 of file range_types.hpp.

◆ null

template<typename T >
constexpr Null<T> storages::postgres::null {}
inlineconstexpr

Template variable to use with query parameters.

trx->Execute("update a_table set val = $1 where val = $2", null<int>, 0)

Definition at line 23 of file null.hpp.