postgresql-copy-escape-0.1: Format data to feed to a PostgreSQL COPY FROM statement

Safe HaskellNone
LanguageHaskell98

Database.PostgreSQL.Copy.Escape

Synopsis

Documentation

data EscapeCopyValue Source #

Constructors

EscapeCopyNull 
EscapeCopyText !ByteString

A PostgreSQL datum in its text representation.

EscapeCopyBytea !ByteString

Raw binary data destined for storage in a BYTEA column.

escapeCopyRow :: [EscapeCopyValue] -> ByteString Source #

Escape a row of data for use with a COPY FROM statement. Include a trailing newline at the end.

This assumes text format (rather than BINARY or CSV) with the default delimiter (tab) and default null string (\N). A suitable query looks like:

COPY tablename (id, col1, col2) FROM stdin;