Matt Parsons
Matt Parsons
In the interim, we're solving this in our work codebase with: ```haskell -- | The extra parens are needed when the argument is a `SELECT` statement. unsafeSqlFunctionWithExtraParens :: UnsafeSqlFunctionArgument a...
#396 mentioned that postgres also supports `WITH`, so we should try and figure that out as well.
If `over_` is instead an infix function, then we can keep `countRows_` as-is and write: ```haskell countRows_ countRows_ `over_` someWindow
I believe you can put a predicate on an OVER with HAVING
I think the way we can do this is: ```haskell updateReturning :: (SqlExpr (Entity val) -> SqlQuery ret) -> SqlWriteT m ret ``` defined in `Database.Esqueleto.PostgreSQL`.
[`esqueleto-2.6.0`](https://hackage.haskell.org/package/esqueleto) was released recently and is going to be in the next stackage LTS I believe.
This is -- unfortunately -- database specific. MySQL and Postgres have different syntax for this functionality. So we'd need to gate that behind the `.MySQL` and `.Postgresql` modules.
I think what we "really" need here is a better way to set cascade behavior on the `persistent`. The issues [#910](https://github.com/yesodweb/persistent/issues/910) and [#999](https://github.com/yesodweb/persistent/issues/999) document this and the PR [#1056](https://github.com/yesodweb/persistent/pull/1056) implements...
Sure! First, you have a Persistent models definition that doesn't include migrations. So you'd have something like: ```haskell share [mkPersist sqlSettings, mkMigration "migrateAll"] $(persistFile "tables.persistentmodels") share [mkPersist sqlSettings] $(persistFile "views.persistentmodels)...
You can definitely work around this with, eg, ```haskell veryUnsafeCoerceSqlExpr :: SqlExpr (Value a) -> SqlExpr (Value b) veryUnsafeCoerceSqlExpr (time1 -. time2) :: SqlExpr (Value Interval) ``` :sweat_smile: