bitemyapp / esqueleto

New home of Esqueleto, please file issues so we can get things caught up!
BSD 3-Clause "New" or "Revised" License
372 stars 107 forks source link

'undefined' with joins in Experimental syntax #241

Closed arthurxavierx closed 3 years ago

arthurxavierx commented 3 years ago

The following query produces an undefined error when run:

foo :: SqlQuery (SqlExpr (Maybe (Entity Foo)), SqlExpr (Maybe (Entity Bar)))
foo = from $ Table @Foo `FullOuterJoin` Table @Bar `on` (\_ -> val False)

The error points to https://github.com/bitemyapp/esqueleto/blob/master/src/Database/Esqueleto/Experimental.hs#L770

I believe the problem is due to the use of a tuple instead of :&, as it was fixed by changing the type of the expression to SqlQuery (SqlExpr (Maybe (Entity Foo)) :& SqlExpr (Maybe (Entity Bar))).

I suspect this also happens to other types of joins, not only to FullOuterJoin, but I have not yet tested it.

belevy commented 3 years ago

this should be fixed in https://github.com/bitemyapp/esqueleto/pull/228 when i get around to finishing it

arthurxavierx commented 3 years ago

@belevy thanks for doing god's work in that PR, it's looking absolutely fantastic!! Looking forward to having it :)