diff --git a/src/Database/Esqueleto/Internal/Language.hs b/src/Database/Esqueleto/Internal/Language.hs index b8d98d5..ac992e1 100644 --- a/src/Database/Esqueleto/Internal/Language.hs +++ b/src/Database/Esqueleto/Internal/Language.hs @@ -829,6 +829,11 @@ data LockingKind = -- PostgreSQL. -- -- /Since: 2.2.7/ + | ForUpdateSkipLocked + -- ^ @FOR UPDATE SKIP LOCKED@ syntax. Supported by MySQL, Oracle and + -- PostgreSQL. + -- + -- /Since: 2.2.7/ | ForShare -- ^ @FOR SHARE@ syntax. Supported by PostgreSQL. -- diff --git a/src/Database/Esqueleto/Internal/Sql.hs b/src/Database/Esqueleto/Internal/Sql.hs index e13877a..16a24e9 100644 --- a/src/Database/Esqueleto/Internal/Sql.hs +++ b/src/Database/Esqueleto/Internal/Sql.hs @@ -1212,9 +1212,10 @@ makeLimit (conn, _) (Limit ml mo) orderByClauses = makeLocking :: LockingClause -> (TLB.Builder, [PersistValue]) makeLocking = flip (,) [] . maybe mempty toTLB . Monoid.getLast where - toTLB ForUpdate = "\nFOR UPDATE" - toTLB ForShare = "\nFOR SHARE" - toTLB LockInShareMode = "\nLOCK IN SHARE MODE" + toTLB ForUpdate = "\nFOR UPDATE" + toTLB ForUpdateSkipLocked = "\nFOR UPDATE SKIP LOCKED" + toTLB ForShare = "\nFOR SHARE" + toTLB LockInShareMode = "\nLOCK IN SHARE MODE" diff --git a/stack-8.4.yaml b/stack-8.4.yaml index 7bbfbb3..05e9eae 100644 --- a/stack-8.4.yaml +++ b/stack-8.4.yaml @@ -5,5 +5,5 @@ packages: extra-deps: - persistent-postgresql-2.8.2.0 -- postgresql-simple-0.5.3.0 +- postgresql-simple-0.5.4.0 allow-newer: true diff --git a/test/Common/Test.hs b/test/Common/Test.hs index 06e8426..fac1135 100644 --- a/test/Common/Test.hs +++ b/test/Common/Test.hs @@ -1333,9 +1333,10 @@ testLocking withConn = do let expected = complex <> "\n" <> syntax (with1, with2, with3) `shouldBe` (expected, expected, expected) - it "looks sane for ForUpdate" $ sanityCheck ForUpdate "FOR UPDATE" - it "looks sane for ForShare" $ sanityCheck ForShare "FOR SHARE" - it "looks sane for LockInShareMode" $ sanityCheck LockInShareMode "LOCK IN SHARE MODE" + it "looks sane for ForUpdate" $ sanityCheck ForUpdate "FOR UPDATE" + it "looks sane for ForUpdateSkipLocked" $ sanityCheck ForUpdateSkipLocked "FOR UPDATE SKIP LOCKED" + it "looks sane for ForShare" $ sanityCheck ForShare "FOR SHARE" + it "looks sane for LockInShareMode" $ sanityCheck LockInShareMode "LOCK IN SHARE MODE"