@@ -93,6 +93,7 @@ import Rel8.Query.Filter ( where_ )
9393import Rel8.Query.List ( catNonEmptyTable )
9494import qualified Rel8.Query.Maybe as Q ( optional )
9595import Rel8.Query.Opaleye ( mapOpaleye, unsafePeekQuery )
96+import Rel8.Query.Rebind ( rebind )
9697import Rel8.Query.These ( alignBy )
9798import Rel8.Table ( Table, fromColumns, toColumns )
9899import Rel8.Table.Aggregate ( hgroupBy, listAgg, nonEmptyAgg )
@@ -508,8 +509,8 @@ alignWith :: EqTable k
508509 -> Tabulation k a -> Tabulation k b -> Tabulation k c
509510alignWith f (Tabulation as) (Tabulation bs) = Tabulation $ \p -> do
510511 tkab <- liftF2 (alignBy condition) as bs p
512+ k <- traverse (rebind "key") $ recover $ bimap fst fst tkab
511513 let
512− k = recover $ bimap fst fst tkab
513514 tab = bimap snd snd tkab
514515 pure (k, f tab)
515516 where