-
-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SelectTransformBuilder doesn't handle subqueries. Cannot make any kind of subquery projection #1924
Comments
Ok, so I have this entirely crazy idea of synthesizing a subquery with primary key join and running the entire expression tree processing for the subquery. It might work but perhaps not in all cases... hmmm... aka, generating a query like this: SELECT
d.data->>'Id' AS Id,
(SELECT id.data->>'RoleIds' FROM mt_doc_user AS id WHERE id.id = d.id LIMIT 1) AS RoleId
FROM mt_doc_user AS d Perhaps in a future release, some subquery collection operations could be translated to direct jsonb functions and eliminate the self-table join, but for now getting it to work in the first place is going to go a long way. |
This is closer to what Marten generates: SELECT
jsonb_build_object(
'Id', d.data->>'Id',
'RoleId', (SELECT id.data->'RoleIds'->>0 FROM mt_doc_user AS id WHERE id.id = d.id LIMIT 1)
)
FROM mt_doc_user AS d |
This needs a refactor to LinqHandlerBuilder to extract out a class that builds Sql and takes a processed model directly. |
This will be a tiny bit easier to do after #1927 is merged. |
It's not a bug per se, just something that's never been implemented. |
Beating this for now w/ the ability to use array indexers and calling that good enough. |
I'm closing this one. We're not going any farther for now. |
Given this class:
This query does not work and throws an exception, it appears to be only expecting sub-member expressions from the RoleIds collection which doesn't work because it's a collection of scalar values.
PR with failing unit test coming.
The text was updated successfully, but these errors were encountered: