diff --git a/changelog.md b/changelog.md index 193b5e7f9..c57d35806 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +3.5.10.3 +======== +- @ttuegel + - [#377](https://github.com/bitemyapp/esqueleto/pull/377) + - Fix Postgres syntax for `noWait` + 3.5.10.2 ======== - @parsonsmatt diff --git a/esqueleto.cabal b/esqueleto.cabal index d8802dc7f..0e9b983b0 100644 --- a/esqueleto.cabal +++ b/esqueleto.cabal @@ -2,7 +2,7 @@ cabal-version: 1.12 name: esqueleto -version: 3.5.10.2 +version: 3.5.10.3 synopsis: Type-safe EDSL for SQL queries on persistent backends. description: @esqueleto@ is a bare bones, type-safe EDSL for SQL queries that works with unmodified @persistent@ SQL backends. Its language closely resembles SQL, so you don't have to learn new concepts, just new syntax, and it's fairly easy to predict the generated SQL and optimize it for your backend. Most kinds of errors committed when writing SQL are caught as compile-time errors---although it is possible to write type-checked @esqueleto@ queries that fail at runtime. . diff --git a/src/Database/Esqueleto/Internal/Internal.hs b/src/Database/Esqueleto/Internal/Internal.hs index 4707048e8..e46516e30 100644 --- a/src/Database/Esqueleto/Internal/Internal.hs +++ b/src/Database/Esqueleto/Internal/Internal.hs @@ -3257,7 +3257,7 @@ makeLocking info (PostgresLockingClauses clauses) = makeLockingStrength PostgresForShare = plain "FOR SHARE" makeLockingBehavior :: OnLockedBehavior -> (TLB.Builder, [PersistValue]) - makeLockingBehavior NoWait = plain "NO WAIT" + makeLockingBehavior NoWait = plain "NOWAIT" makeLockingBehavior SkipLocked = plain "SKIP LOCKED" makeLockingBehavior Wait = plain "" diff --git a/src/Database/Esqueleto/PostgreSQL.hs b/src/Database/Esqueleto/PostgreSQL.hs index 11197b064..3011741b4 100644 --- a/src/Database/Esqueleto/PostgreSQL.hs +++ b/src/Database/Esqueleto/PostgreSQL.hs @@ -441,7 +441,7 @@ values exprs = Ex.From $ do , params ) --- | `NO WAIT` syntax for postgres locking +-- | `NOWAIT` syntax for postgres locking -- error will be thrown if locked rows are attempted to be selected -- -- @since 3.5.9.0 diff --git a/test/PostgreSQL/Test.hs b/test/PostgreSQL/Test.hs index 3ff87a1da..9e144e2be 100644 --- a/test/PostgreSQL/Test.hs +++ b/test/PostgreSQL/Test.hs @@ -1423,6 +1423,15 @@ testPostgresqlLocking = do asserting sideThreadAsserts asserting $ length nonLockedRowsAfterUpdate `shouldBe` 3 + describe "noWait" $ do + itDb "doesn't crash" $ do + select $ do + t <- Experimental.from $ table @Person + EP.forUpdateOf t EP.noWait + pure t + + asserting noExceptions + -- Since lateral queries arent supported in Sqlite or older versions of mysql -- the test is in the Postgres module testLateralQuery :: SpecDb