diff --git a/Database/PostgreSQL/LibPQ.hsc b/Database/PostgreSQL/LibPQ.hsc
--- a/Database/PostgreSQL/LibPQ.hsc
+++ b/Database/PostgreSQL/LibPQ.hsc
@@ -143,6 +143,11 @@
     , escapeByteaConn
     , unescapeBytea
 
+    -- * Using COPY FROM
+    , CopyResult(..)
+    , putCopyData
+    , putCopyEnd
+
     -- * Asynchronous Command Processing
     -- $asynccommand
     , sendQuery
@@ -203,6 +208,9 @@
 import Foreign
 import Foreign.C.Types
 import Foreign.C.String
+#if __GLASGOW_HASKELL__ >= 702
+import qualified Foreign.ForeignPtr.Unsafe as Unsafe
+#endif
 import qualified Foreign.Concurrent as FC
 import System.Posix.Types ( Fd(..) )
 import Data.List ( foldl' )
@@ -290,7 +298,11 @@
 
 -- | Test if a connection is the Null Connection.
 isNullConnection :: Connection -> Bool
+#if __GLASGOW_HASKELL__ >= 702
+isNullConnection (Conn x) = Unsafe.unsafeForeignPtrToPtr x == nullPtr
+#else
 isNullConnection (Conn x) = unsafeForeignPtrToPtr x == nullPtr
+#endif
 {-# INLINE isNullConnection #-}
 
 -- | If 'connectStart' succeeds, the next stage is to poll libpq so
@@ -1499,6 +1511,66 @@
                     return $ Just $ B.fromForeignPtr tofp 0 $ fromIntegral l
 
 
+-- $copyfrom
+--
+-- This provides support for PostgreSQL's @COPY FROM@ facility.
+--
+-- For more information, see:
+--
+--  * <http://www.postgresql.org/docs/current/static/sql-copy.html>
+--
+--  * <http://www.postgresql.org/docs/current/static/libpq-copy.html>
+--
+
+data CopyResult = CopyOk            -- ^ The data was sent.
+                | CopyError         -- ^ An error occurred (use 'errorMessage'
+                                    --   to retrieve details).
+                | CopyWouldBlock    -- ^ The data was not sent because the
+                                    --   attempt would block (this case is only
+                                    --   possible if the connection is in
+                                    --   nonblocking mode)  Wait for
+                                    --   write-ready (e.g. by using
+                                    --   'Control.Concurrent.threadWaitWrite'
+                                    --   on the 'socket') and try again.
+
+
+toCopyResult :: CInt -> CopyResult
+toCopyResult n | n < 0     = CopyError
+               | n == 0    = CopyWouldBlock
+               | otherwise = CopyOk
+
+
+-- | Send raw @COPY@ data to the server during the 'CopyIn' state.
+putCopyData :: Connection -> B.ByteString -> IO CopyResult
+putCopyData conn bs =
+    B.unsafeUseAsCStringLen bs $ putCopyCString conn
+
+
+putCopyCString :: Connection -> CStringLen -> IO CopyResult
+putCopyCString conn (str, len) =
+    fmap toCopyResult $
+        withConn conn $ \ptr -> c_PQputCopyData ptr str (fromIntegral len)
+
+
+-- | Send end-of-data indication to the server during the 'CopyIn' state.
+--
+--  * @putCopyEnd conn Nothing@ ends the 'CopyIn' operation successfully.
+--
+--  * @putCopyEnd conn (Just errormsg)@ forces the @COPY@ to fail, with
+--    @errormsg@ used as the error message.
+--
+-- After 'putCopyEnd' returns 'CopyOk', call 'getResult' to obtain the final
+-- result status of the @COPY@ command.  Then return to normal operation.
+putCopyEnd :: Connection -> Maybe B.ByteString -> IO CopyResult
+putCopyEnd conn Nothing =
+    fmap toCopyResult $
+        withConn conn $ \ptr -> c_PQputCopyEnd ptr nullPtr
+putCopyEnd conn (Just errormsg) =
+    fmap toCopyResult $
+        B.useAsCString errormsg $ \errormsg_cstr ->
+            withConn conn $ \ptr -> c_PQputCopyEnd ptr errormsg_cstr
+
+
 -- $asynccommand
 -- The 'exec' function is adequate for submitting commands in normal,
 -- synchronous applications. It has a couple of deficiencies, however,
@@ -2286,6 +2358,12 @@
 type PGVerbosity = CInt
 foreign import ccall unsafe "libpq-fe.h PQsetErrorVerbosity"
     c_PQsetErrorVerbosity :: Ptr PGconn -> PGVerbosity -> IO PGVerbosity
+
+foreign import ccall        "libpq-fe.h PQputCopyData"
+    c_PQputCopyData :: Ptr PGconn -> Ptr CChar -> CInt -> IO CInt
+
+foreign import ccall        "libpq-fe.h PQputCopyEnd"
+    c_PQputCopyEnd :: Ptr PGconn -> CString -> IO CInt
 
 foreign import ccall        "libpq-fe.h PQsendQuery"
     c_PQsendQuery :: Ptr PGconn -> CString ->IO CInt
diff --git a/postgresql-libpq.cabal b/postgresql-libpq.cabal
--- a/postgresql-libpq.cabal
+++ b/postgresql-libpq.cabal
@@ -1,5 +1,5 @@
 Name:                postgresql-libpq
-Version:             0.7.1
+Version:             0.7.2
 Synopsis:            low-level binding to libpq
 
 Description:         This is a binding to libpq: the C application
@@ -38,4 +38,4 @@
 source-repository this
   type:     git
   location: http://github.com/lpsmith/postgresql-libpq
-  tag:      v0.7.1
+  tag:      v0.7.2
