HDBC-postgresql-2.3.2.7: PostgreSQL driver for HDBC
CopyrightCopyright (C) 2005-2011 John Goerzen
LicenseBSD3
MaintainerJohn Goerzen <jgoerzen@complete.org>
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Database.HDBC.PostgreSQL

Description

HDBC driver interface for PostgreSQL 8.x

Written by John Goerzen, jgoerzen@complete.org

NOTE ON DATES AND TIMES

The recommended correspondence between PostgreSQL date and time types and HDBC SqlValue types is:

  • SqlLocalDate: DATE
  • SqlLocalTimeOfDay: TIME WITHOUT TIME ZONE
  • SqlZonedLocalTimeOfDay: TIME WITH TIME ZONE
  • SqlLocalTime: TIMESTAMP WITHOUT TIME ZONE
  • SqlZonedTime: TIMESTAMP WITH TIME ZONE
  • SqlUTCTime: TIMESTAMP WITH TIME ZONE
  • SqlDiffTime: INTERVAL
  • SqlPOSIXTime: NUMERIC
  • SqlEpochTime: INTEGER
  • SqlTimeDiff: INTERVAL

Other combinations are possible, and may even be converted automatically. The above simply represents the types that seem the most logical correspondence, and thus are tested by the HDBC-PostgreSQL test suite.

Synopsis

Connecting to Databases

connectPostgreSQL :: String -> IO Connection Source #

Connect to a PostgreSQL server.

See http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT for the meaning of the connection string.

withPostgreSQL :: String -> (Connection -> IO a) -> IO a Source #

Connect to a PostgreSQL server, and automatically disconnect if the handler exits normally or throws an exception.

withPostgreSQL' :: String -> (Connection -> IO a) -> IO a Source #

data Connection Source #

Instances

Instances details
IConnection Connection Source # 
Instance details

Defined in Database.HDBC.PostgreSQL.ConnectionImpl

Transactions

begin :: Connection -> IO () Source #

PostgreSQL Error Codes

When an SqlError is thrown, the field seState is set to one of the following error codes.

successfulCompletion :: String Source #

Is set to "00000".

warning :: String Source #

Is set to "01000".

warningDynamicResultSetsReturned :: String Source #

Is set to "0100C".

warningImplicitZeroBitPadding :: String Source #

Is set to "01008".

warningPrivilegeNotGranted :: String Source #

Is set to "01007".

warningPrivilegeNotRevoked :: String Source #

Is set to "01006".

warningStringDataRightTruncation :: String Source #

Is set to "01004".

warningDeprecatedFeature :: String Source #

Is set to "01P01".

noData :: String Source #

Is set to "02000".

noAdditionalDynamicResultSetsReturned :: String Source #

Is set to "02001".

sqlStatementNotYetComplete :: String Source #

Is set to "03000".

connectionException :: String Source #

Is set to "08000".

connectionDoesNotExist :: String Source #

Is set to "08003".

connectionFailure :: String Source #

Is set to "08006".

transactionResolutionUnknown :: String Source #

Is set to "08007".

protocolViolation :: String Source #

Is set to "08P01".

triggeredActionException :: String Source #

Is set to "09000".

featureNotSupported :: String Source #

Is set to "0A000".

invalidTransactionInitiation :: String Source #

Is set to "0B000".

locatorException :: String Source #

Is set to "0F000".

lEInvalidSpecification :: String Source #

Is set to "0F001".

invalidGrantor :: String Source #

Is set to "0L000".

invalidGrantOperation :: String Source #

Is set to "0LP01".

invalidRoleSpecification :: String Source #

Is set to "0P000".

cardinalityViolation :: String Source #

Is set to "21000".

dataException :: String Source #

Is set to "22000".

arrayElementError :: String Source #

Is set to "2202E".

characterNotInRepertoire :: String Source #

Is set to "22021".

datetimeFieldOverflow :: String Source #

Is set to "22008".

divisionByZero :: String Source #

Is set to "22012".

errorInAssignment :: String Source #

Is set to "22005".

escapeCharacterConflict :: String Source #

Is set to "2200B".

indicatorOverflow :: String Source #

Is set to "22022".

intervalFieldOverflow :: String Source #

Is set to "22015".

invalidArgumentForLog :: String Source #

Is set to "2201E".

invalidArgumentForPowerFunction :: String Source #

Is set to "2201F".

invalidArgumentForWidthBucketFunction :: String Source #

Is set to "2201G".

invalidCharacterValueForCast :: String Source #

Is set to "22018".

invalidDatetimeFormat :: String Source #

Is set to "22007".

invalidEscapeCharacter :: String Source #

Is set to "22019".

invalidEscapeOctet :: String Source #

Is set to "2200D".

invalidEscapeSequence :: String Source #

Is set to "22025".

nonstandardUseOfEscapeCharacter :: String Source #

Is set to "22P06".

invalidIndicatorParameterValue :: String Source #

Is set to "22010".

invalidLimitValue :: String Source #

Is set to "22020".

invalidParameterValue :: String Source #

Is set to "22023".

invalidRegularExpression :: String Source #

Is set to "2201B".

invalidTimeZoneDisplacementValue :: String Source #

Is set to "22009".

invalidUseOfEscapeCharacter :: String Source #

Is set to "2200C".

mostSpecificTypeMismatch :: String Source #

Is set to "2200G".

nullValueNotAllowed :: String Source #

Is set to "22004".

nullValueNoIndicatorParameter :: String Source #

Is set to "22002".

numericValueOutOfRange :: String Source #

Is set to "22003".

stringDataLengthMismatch :: String Source #

Is set to "22026".

stringDataRightTruncation :: String Source #

Is set to "22001".

substringError :: String Source #

Is set to "22011".

trimError :: String Source #

Is set to "22027".

unterminatedCString :: String Source #

Is set to "22024".

zeroLengthCharacterString :: String Source #

Is set to "2200F".

floatingPointException :: String Source #

Is set to "22P01".

invalidTextRepresentation :: String Source #

Is set to "22P02".

invalidBinaryRepresentation :: String Source #

Is set to "22P03".

badCopyFileFormat :: String Source #

Is set to "22P04".

untranslatableCharacter :: String Source #

Is set to "22P05".

notAnXmlDocument :: String Source #

Is set to "2200L".

invalidXmlDocument :: String Source #

Is set to "2200M".

invalidXmlContent :: String Source #

Is set to "2200N".

invalidXmlComment :: String Source #

Is set to "2200S".

invalidXmlProcessingInstruction :: String Source #

Is set to "2200T".

integrityConstraintViolation :: String Source #

Is set to "23000".

restrictViolation :: String Source #

Is set to "23001".

notNullViolation :: String Source #

Is set to "23502".

foreignKeyViolation :: String Source #

Is set to "23503".

uniqueViolation :: String Source #

Is set to "23505".

checkViolation :: String Source #

Is set to "23514".

invalidCursorState :: String Source #

Is set to "24000".

invalidTransactionState :: String Source #

Is set to "25000".

activeSqlTransaction :: String Source #

Is set to "25001".

branchTransactionAlreadyActive :: String Source #

Is set to "25002".

heldCursorRequiresSameIsolationLevel :: String Source #

Is set to "25008".

readOnlySqlTransaction :: String Source #

Is set to "25006".

noActiveSqlTransaction :: String Source #

Is set to "25P01".

inFailedSqlTransaction :: String Source #

Is set to "25P02".

invalidSqlStatementName :: String Source #

Is set to "26000".

triggeredDataChangeViolation :: String Source #

Is set to "27000".

invalidAuthorizationSpecification :: String Source #

Is set to "28000".

dependentObjectsStillExist :: String Source #

Is set to "2BP01".

invalidTransactionTermination :: String Source #

Is set to "2D000".

sqlRoutineException :: String Source #

Is set to "2F000".

sREFunctionExecutedNoReturnStatement :: String Source #

Is set to "2F005".

sREModifyingSqlDataNotPermitted :: String Source #

Is set to "2F002".

sREProhibitedSqlStatementAttempted :: String Source #

Is set to "2F003".

sREReadingSqlDataNotPermitted :: String Source #

Is set to "2F004".

invalidCursorName :: String Source #

Is set to "34000".

externalRoutineException :: String Source #

Is set to "38000".

eREContainingSqlNotPermitted :: String Source #

Is set to "38001".

eREModifyingSqlDataNotPermitted :: String Source #

Is set to "38002".

eREProhibitedSqlStatementAttempted :: String Source #

Is set to "38003".

eREReadingSqlDataNotPermitted :: String Source #

Is set to "38004".

externalRoutineInvocationException :: String Source #

Is set to "39000".

eRIEInvalidSqlstateReturned :: String Source #

Is set to "39001".

eRIENullValueNotAllowed :: String Source #

Is set to "39004".

eRIETriggerProtocolViolated :: String Source #

Is set to "39P01".

eRIESrfProtocolViolated :: String Source #

Is set to "39P02".

savepointException :: String Source #

Is set to "3B000".

sEInvalidSpecification :: String Source #

Is set to "3B001".

invalidCatalogName :: String Source #

Is set to "3D000".

invalidSchemaName :: String Source #

Is set to "3F000".

transactionRollback :: String Source #

Is set to "40000".

tRIntegrityConstraintViolation :: String Source #

Is set to "40002".

tRSerializationFailure :: String Source #

Is set to "40001".

tRStatementCompletionUnknown :: String Source #

Is set to "40003".

tRDeadlockDetected :: String Source #

Is set to "40P01".

syntaxErrorOrAccessRuleViolation :: String Source #

Is set to "42000".

syntaxError :: String Source #

Is set to "42601".

insufficientPrivilege :: String Source #

Is set to "42501".

cannotCoerce :: String Source #

Is set to "42846".

groupingError :: String Source #

Is set to "42803".

invalidForeignKey :: String Source #

Is set to "42830".

invalidName :: String Source #

Is set to "42602".

nameTooLong :: String Source #

Is set to "42622".

reservedName :: String Source #

Is set to "42939".

datatypeMismatch :: String Source #

Is set to "42804".

indeterminateDatatype :: String Source #

Is set to "42P18".

wrongObjectType :: String Source #

Is set to "42809".

undefinedColumn :: String Source #

Is set to "42703".

undefinedFunction :: String Source #

Is set to "42883".

undefinedTable :: String Source #

Is set to "42P01".

undefinedParameter :: String Source #

Is set to "42P02".

undefinedObject :: String Source #

Is set to "42704".

duplicateColumn :: String Source #

Is set to "42701".

duplicateCursor :: String Source #

Is set to "42P03".

duplicateDatabase :: String Source #

Is set to "42P04".

duplicateFunction :: String Source #

Is set to "42723".

duplicatePstatement :: String Source #

Is set to "42P05".

duplicateSchema :: String Source #

Is set to "42P06".

duplicateTable :: String Source #

Is set to "42P07".

duplicateAlias :: String Source #

Is set to "42712".

duplicateObject :: String Source #

Is set to "42710".

ambiguousColumn :: String Source #

Is set to "42702".

ambiguousFunction :: String Source #

Is set to "42725".

ambiguousParameter :: String Source #

Is set to "42P08".

ambiguousAlias :: String Source #

Is set to "42P09".

invalidColumnReference :: String Source #

Is set to "42P10".

invalidColumnDefinition :: String Source #

Is set to "42611".

invalidCursorDefinition :: String Source #

Is set to "42P11".

invalidDatabaseDefinition :: String Source #

Is set to "42P12".

invalidFunctionDefinition :: String Source #

Is set to "42P13".

invalidPstatementDefinition :: String Source #

Is set to "42P14".

invalidSchemaDefinition :: String Source #

Is set to "42P15".

invalidTableDefinition :: String Source #

Is set to "42P16".

invalidObjectDefinition :: String Source #

Is set to "42P17".

withCheckOptionViolation :: String Source #

Is set to "44000".

insufficientResources :: String Source #

Is set to "53000".

diskFull :: String Source #

Is set to "53100".

outOfMemory :: String Source #

Is set to "53200".

tooManyConnections :: String Source #

Is set to "53300".

programLimitExceeded :: String Source #

Is set to "54000".

statementTooComplex :: String Source #

Is set to "54001".

tooManyColumns :: String Source #

Is set to "54011".

tooManyArguments :: String Source #

Is set to "54023".

objectNotInPrerequisiteState :: String Source #

Is set to "55000".

objectInUse :: String Source #

Is set to "55006".

cantChangeRuntimeParam :: String Source #

Is set to "55P02".

lockNotAvailable :: String Source #

Is set to "55P03".

operatorIntervention :: String Source #

Is set to "57000".

queryCanceled :: String Source #

Is set to "57014".

adminShutdown :: String Source #

Is set to "57P01".

crashShutdown :: String Source #

Is set to "57P02".

cannotConnectNow :: String Source #

Is set to "57P03".

ioError :: String Source #

Is set to "58030".

undefinedFile :: String Source #

Is set to "58P01".

duplicateFile :: String Source #

Is set to "58P02".

configFileError :: String Source #

Is set to "F0000".

lockFileExists :: String Source #

Is set to "F0001".

plpgsqlError :: String Source #

Is set to "P0000".

raiseException :: String Source #

Is set to "P0001".

noDataFound :: String Source #

Is set to "P0002".

tooManyRows :: String Source #

Is set to "P0003".

internalError :: String Source #

Is set to "XX000".

dataCorrupted :: String Source #

Is set to "XX001".

indexCorrupted :: String Source #

Is set to "XX002".

Threading

Provided the local libpq library is thread-safe, multiple Connections may be used to have concurrent database queries. Concurrent queries issued on a single Connection will be performed serially.

When the local libpq library is not thread-safe (ie. it has not been compiled with --enable-thread-safety), only a single database function will be performed at a time.