diff --git a/src/Rel8/Query/Rebind.hs b/src/Rel8/Query/Rebind.hs index 159ef012..e5629acd 100644 --- a/src/Rel8/Query/Rebind.hs +++ b/src/Rel8/Query/Rebind.hs @@ -16,6 +16,7 @@ import qualified Opaleye.Internal.Rebind as Opaleye -- rel8 import Rel8.Expr ( Expr ) import Rel8.Query ( Query ) +import Rel8.Query.Limit (offset) import Rel8.Schema.HTable (HTable) import Rel8.Table ( Table ) import Rel8.Table.Cols (Cols (Cols)) @@ -27,7 +28,8 @@ import Rel8.Query.Opaleye (fromOpaleye) -- to a new variable in the SQL. The @a@ returned consists only of these -- variables. It's essentially a @let@ binding for Postgres expressions. rebind :: Table Expr a => String -> a -> Query a -rebind prefix a = fromOpaleye (Opaleye.rebindExplicitPrefix prefix unpackspec <<< pure a) +rebind prefix a = offset 0 $ + fromOpaleye (Opaleye.rebindExplicitPrefix prefix unpackspec <<< pure a) hrebind :: HTable t => String -> t Expr -> Query (t Expr)