@@ -24,8 +24,8 @@ import Rel8.Expr.Aggregate ( listAggExpr, nonEmptyAggExpr )
2424import Rel8.Expr.Opaleye ( mapPrimExpr )
2525import Rel8.Query ( Query )
2626import Rel8.Query.Aggregate ( aggregate )
27−import Rel8.Query.Evaluate ( rebind )
2827import Rel8.Query.Maybe ( optional )
28+import Rel8.Query.Rebind ( rebind )
2929import Rel8.Schema.HTable.Vectorize ( hunvectorize )
3030import Rel8.Schema.Null ( Sql, Unnullify )
3131import Rel8.Schema.Spec ( Spec( Spec, info ) )
@@ -85,8 +85,9 @@ someExpr = aggregate . fmap nonEmptyAggExpr
8585--
8686-- @catListTable@ is an inverse to 'many'.
8787catListTable :: Table Expr a => ListTable Expr a -> Query a
88−catListTable (ListTable as) = rebind $ fromColumns $ runIdentity $
89− hunvectorize (\Spec {info} -> pure . sunnest info) as
88+catListTable (ListTable as) =
89+ rebind "unnest" $ fromColumns $ runIdentity $
90+ hunvectorize (\Spec {info} -> pure . sunnest info) as
9091
9192
9293-- | Expand a 'NonEmptyTable' into a 'Query', where each row in the query is an
@@ -94,8 +95,9 @@ catListTable (ListTable as) = rebind $ fromColumns $ runIdentity $
9495--
9596-- @catNonEmptyTable@ is an inverse to 'some'.
9697catNonEmptyTable :: Table Expr a => NonEmptyTable Expr a -> Query a
97−catNonEmptyTable (NonEmptyTable as) = rebind $ fromColumns $ runIdentity $
98− hunvectorize (\Spec {info} -> pure . sunnest info) as
98+catNonEmptyTable (NonEmptyTable as) =
99+ rebind "unnest" $ fromColumns $ runIdentity $
100+ hunvectorize (\Spec {info} -> pure . sunnest info) as
99101
100102
101103-- | Expand an expression that contains a list into a 'Query', where each row
@@ -103,7 +105,7 @@ catNonEmptyTable (NonEmptyTable as) = rebind $ fromColumns $ runIdentity $
103105--
104106-- @catList@ is an inverse to 'manyExpr'.
105107catList :: Sql DBType a => Expr [a] -> Query (Expr a)
106−catList = rebind . sunnest typeInformation
108+catList = rebind "unnest" . sunnest typeInformation
107109
108110
109111-- | Expand an expression that contains a non-empty list into a 'Query', where
@@ -111,7 +113,7 @@ catList = rebind . sunnest typeInformation
111113--
112114-- @catNonEmpty@ is an inverse to 'someExpr'.
113115catNonEmpty :: Sql DBType a => Expr (NonEmpty a) -> Query (Expr a)
114−catNonEmpty = rebind . sunnest typeInformation
116+catNonEmpty = rebind "unnest" . sunnest typeInformation
115117
116118
117119sunnest :: TypeInformation (Unnullify a) -> Expr (list a) -> Expr a