diff --git a/src/PgQuery.hs b/src/PgQuery.hs index 65f4d91bc..8702520f7 100644 --- a/src/PgQuery.hs +++ b/src/PgQuery.hs @@ -109,6 +109,7 @@ insert schema table row conn = do query <- populateSql conn ("insert into %I.%I ("++colIds++")", map toSql $ schema:table:cols) stmt <- prepare conn (query ++ " values ("++phs++") returning *") _ <- execute stmt values + commit conn keys <- getColumnNames stmt Just vals <- fetchRow stmt let rowMap = fromList $ zip keys vals diff --git a/test/PgQuerySpec.hs b/test/PgQuerySpec.hs index 9ec72211e..c2dce83a9 100644 --- a/test/PgQuerySpec.hs +++ b/test/PgQuerySpec.hs @@ -17,7 +17,6 @@ loadFixture name = do runRaw conn "drop schema if exists public cascade" runRaw conn "create schema public" runRaw conn sql - commit conn return conn main :: IO () @@ -31,7 +30,6 @@ spec = beforeAll (loadFixture "schema") $ do ("non_nullable_string", toSql ("a string that isn't null" :: String)) ]) conn r <- quickQuery conn "select count(1) from auto_incrementing_pk" [] - commit conn [[toSql (1 :: Int)]] `shouldBe` r describe "insert again" $