rel8
rel8 copied to clipboard
Unable to select from functions
As mentioned by @ocharles here, it's not yet possible to select from a function result. This is something that will be fairly critical for constructing more complex JSON-related queries.
I think this is actually possible in Opaleye, we need to use the RepExpr
constructor of PrimQuery
.
Yea, I think I mentioned that in private on Slack - but I'm not even sure if Opaleye uses that constructor! Maybe just left-over from forking from HaskellDB :) Either way, that looks like the right tool.
relExpr
postdates HaskellDB and is supposed to work but I'm not sure if anyone uses it in practice.
I've just run into this issue too, I was wondering if it's possible to treat a field which is JSONBEncoded
as something I can query into and treat fields as expressions themselves. It looks like Opaleye has support for dealing with JSON(B) encoded columns and pulling out data, but I'm not sure how to tap into the underlying structure.
Does anyone have any example code for haw you might be able to do that?
This would be a killer app for us if we could use it, we have a lot of tables with the same schema where each table has some metadata columns and a payload column as JSONB.