You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When requesting fields from another model, a subquery is typically used when there is no filter provided. If however the handler then defines the filter, the nested model join is not converted from a Subquery to a JOIN, causing SQL errors. Tables referenced within a subquery are not available outside of that subquery, which is why we need regular JOINs.
dare.options.models.nestedTable={get(options){options.filter={is_deleted: 0};// should have been a `join` not a `filter`}};constquery={// ..fields: ['field',{nestedTable: ['field']]};
Will produce SQL
SELECT ..., (SELECT JSON_OBJECT('field', b.field) FROM nestedTable b WHEREa.id=b.a_id) as nestedTable
FROM ...
WHEREb.is_deleted=0-- Error: Unknown column 'b.is_deleted' in 'where clause'
Approach
Allow setting of the filter in nested fields, but convert the request into a JOIN if it is not already.
The text was updated successfully, but these errors were encountered:
When requesting fields from another model, a subquery is typically used when there is no filter provided. If however the handler then defines the filter, the nested model join is not converted from a Subquery to a JOIN, causing SQL errors. Tables referenced within a subquery are not available outside of that subquery, which is why we need regular JOINs.
Will produce SQL
Approach
Allow setting of the
filter
in nested fields, but convert the request into aJOIN
if it is not already.The text was updated successfully, but these errors were encountered: