Add no primary key warning message.

This commit is contained in:
Kei Hibino 2014-10-10 20:23:08 +09:00
parent 692bb7ea70
commit dc7beb9803

View File

@ -107,6 +107,9 @@ defineTableFromDB connect drv scm tbl derives = do
return (cols, notNullIdxs, primCols) ) return (cols, notNullIdxs, primCols) )
(cols, notNullIdxs, primaryCols) <- runIO getDBinfo (cols, notNullIdxs, primaryCols) <- runIO getDBinfo
when (null primaryCols) . reportWarning
$ "getPrimaryKey: Primary key not found for table: " ++ scm ++ "." ++ tbl
let colIxMap = Map.fromList $ zip [c | (c, _) <- cols] [(0 :: Int) .. ] let colIxMap = Map.fromList $ zip [c | (c, _) <- cols] [(0 :: Int) .. ]
lookup' k = do lookup' k = do
let found = Map.lookup k colIxMap let found = Map.lookup k colIxMap