beam-postgres 0.5.2.1 → 0.5.3.0
raw patch · 5 files changed
+22/−7 lines, 5 filesdep ~aesondep ~beam-coredep ~textPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: aeson, beam-core, text, time
API changes (from Hackage documentation)
- Database.Beam.Postgres.Full: type family PgReturningType cmd :: * -> *;
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.LibPQ.Oid
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Integer.Type.Integer
+ Database.Beam.Postgres.Full: type PgReturningType cmd :: * -> *;
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.LibPQ.Oid.Oid
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Num.Integer.Integer
- Database.Beam.Postgres.Full: onConflictUpdateAll :: forall be (table :: (Type -> Type) -> Type). (BeamHasInsertOnConflict be, Beamable table) => SqlConflictAction be table
+ Database.Beam.Postgres.Full: onConflictUpdateAll :: forall be (table :: (Type -> Type) -> TYPE LiftedRep). (BeamHasInsertOnConflict be, Beamable table) => SqlConflictAction be table
Files
- Database/Beam/Postgres/Connection.hs +3/−0
- Database/Beam/Postgres/Full.hs +1/−0
- Database/Beam/Postgres/Syntax.hs +4/−2
- beam-postgres.cabal +5/−5
- test/Database/Beam/Postgres/Test/Select.hs +9/−0
Database/Beam/Postgres/Connection.hs view
@@ -354,6 +354,9 @@ Nothing -> pure (Just x) Just _ -> pure Nothing + runReturningFirst cmd =+ liftF (PgRunReturning AtOnce cmd id id)+ runReturningList cmd = liftF (PgRunReturning AtOnce cmd consume id) where
Database/Beam/Postgres/Full.hs view
@@ -260,6 +260,7 @@ lateral_ using mkSubquery = do let Q subquery = mkSubquery (rewriteThread (Proxy @(QNested s)) using) Q (liftF (QArbitraryJoin subquery+ "lat_" (\a b on' -> case on' of Nothing ->
Database/Beam/Postgres/Syntax.hs view
@@ -774,6 +774,8 @@ inE e es = PgExpressionSyntax $ pgParens (fromPgExpression e) <> emit " IN " <> pgParens (pgSepBy (emit ", ") (map fromPgExpression es))+ inSelectE e sel = PgExpressionSyntax $ pgParens (fromPgExpression e) <> emit " IN " <>+ pgParens (fromPgSelect sel) instance IsSql99FunctionExpressionSyntax PgExpressionSyntax where functionCallE name args =@@ -921,8 +923,8 @@ -- According to the note at <https://www.postgresql.org/docs/9.2/static/functions-aggregate.html> -- the following functions are equivalent.- someE = pgUnAgg "BOOL_ANY"- anyE = pgUnAgg "BOOL_ANY"+ someE = pgUnAgg "BOOL_OR"+ anyE = pgUnAgg "BOOL_OR" instance IsSql92AggregationSetQuantifierSyntax PgAggregationSetQuantifierSyntax where setQuantifierDistinct = PgAggregationSetQuantifierSyntax $ emit "DISTINCT"
beam-postgres.cabal view
@@ -1,5 +1,5 @@ name: beam-postgres-version: 0.5.2.1+version: 0.5.3.0 synopsis: Connection layer between beam and postgres description: Beam driver for <https://www.postgresql.org/ PostgreSQL>, an advanced open-source RDBMS homepage: https://haskell-beam.github.io/beam/user-guide/backends/beam-postgres@@ -33,24 +33,24 @@ Database.Beam.Postgres.Types build-depends: base >=4.9 && <5.0,- beam-core >=0.9 && <0.10,+ beam-core >=0.10 && <0.11, beam-migrate >=0.5 && <0.6, postgresql-libpq >=0.8 && <0.10, postgresql-simple >=0.5 && <0.7, - text >=1.0 && <1.3,+ text >=1.0 && <2.1, bytestring >=0.10 && <0.12, attoparsec >=0.13 && <0.15, hashable >=1.1 && <1.5, lifted-base >=0.2 && <0.3, free >=4.12 && <5.2,- time >=1.6 && <1.12,+ time >=1.6 && <1.13, monad-control >=1.0 && <1.1, mtl >=2.1 && <2.3, conduit >=1.2 && <1.4,- aeson >=0.11 && <2.1,+ aeson >=0.11 && <2.2, uuid-types >=1.0 && <1.1, case-insensitive >=1.2 && <1.3, scientific >=0.3 && <0.4,
test/Database/Beam/Postgres/Test/Select.hs view
@@ -43,6 +43,7 @@ , testUuuidInValues getConn ] , testInRowValues getConn+ , testInSelect getConn , testReturningMany getConn , testPgUnnest getConn ]@@ -97,6 +98,14 @@ let pair :: forall ctx s. Pair (QGenExpr ctx Postgres s) pair = val_ $ Pair False False return $ pair `in_` [pair, pair]+ assertEqual "result" [True] result++testInSelect :: IO ByteString -> TestTree+testInSelect getConn = testCase "IN (SELECT ...) works" $+ withTestPostgres "db_in_row_values" getConn $ \conn -> do+ result <- runBeamPostgres conn $ runSelectReturningList $ select $ do+ let x = as_ @Int32 (val_ 1)+ return $ x `inQuery_` ( pgUnnestArray $ array_ $ (as_ @Int32 . val_) <$> [0..100]) assertEqual "result" [True] result testReturningMany :: IO ByteString -> TestTree