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

Contents

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.

Transactions

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".

noData :: String Source #

Is set to "02000".

connectionException :: String Source #

Is set to "08000".

connectionDoesNotExist :: String Source #

Is set to "08003".

connectionFailure :: String Source #

Is set to "08006".

protocolViolation :: String Source #

Is set to "08P01".

featureNotSupported :: String Source #

Is set to "0A000".

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".

cardinalityViolation :: String Source #

Is set to "21000".

dataException :: String Source #

Is set to "22000".

arrayElementError :: String Source #

Is set to "2202E".

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".

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".

invalidLimitValue :: String Source #

Is set to "22020".

invalidParameterValue :: String Source #

Is set to "22023".

nullValueNotAllowed :: String Source #

Is set to "22004".

numericValueOutOfRange :: String Source #

Is set to "22003".

substringError :: String Source #

Is set to "22011".

trimError :: String Source #

Is set to "22027".

unterminatedCString :: String Source #

Is set to "22024".

floatingPointException :: String Source #

Is set to "22P01".

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".

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".

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".

sqlRoutineException :: String Source #

Is set to "2F000".

invalidCursorName :: String Source #

Is set to "34000".

eRIENullValueNotAllowed :: String Source #

Is set to "39004".

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".

tRSerializationFailure :: String Source #

Is set to "40001".

tRDeadlockDetected :: String Source #

Is set to "40P01".

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".

invalidSchemaDefinition :: String Source #

Is set to "42P15".

invalidTableDefinition :: String Source #

Is set to "42P16".

invalidObjectDefinition :: String Source #

Is set to "42P17".

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".

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.