postgresql-orm-0.4.1: An ORM (Object Relational Mapping) and migrations DSL for PostgreSQL.

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.Describe

Description

Utility function for describing a table in the database.

Synopsis

Documentation

data ColumnInfo Source

Constructors

ColumnInfo 

Fields

colNum :: !Int16

Internal column number used by PostgreSQL. Generally these will be consecutive starting from 1, but this may not be the case if you have altered a table to delete columns.

colName :: ByteString

Name of the column

colType :: !TypeInfo

Type of the column

colNotNull :: !Bool

If True, the database cannot contain null. (This constraint should always be accurate.)

colPrimary :: !Bool

True if this column (and only this column) constitutes the primary key of the table. Always False if the primary key comprises multiple columns (even if this is one of those columns).

colUnique :: !Bool

True if there is a uniqueness constraint on this column. Not True if this column is part of a uniqueness constraint involving multiple columns. (Such multi-column uniqueness constraints are not reported by this interface.)

colReferences :: !(Maybe ByteString)

If this there is a foreign key constraint on this column (and the constraint does not span multiple columns), report the table referenced by this column.

describeTable :: Connection -> ByteString -> IO [ColumnInfo] Source

Returns a list of ColumnInfo structures for a particular table. Not all information about a table is returned. In particular, constraints that span columns are ignored.