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
Notice the WHERE clause references the column other_models_count on the my_model table instead of on t1. The query works fine without giving a cursor offset as no WHERE clause is included on the SQL query. This issue happens when ordering by either type of edge order field: count and field (this example shows a count).
I've also set the engql.MultiOrder annotation on these models if that is relevant.
Expected Behavior 馃
The query should construct a SQL query that does not produce an error by referencing the subquery table for the edge order field instead of the main table. Should look like this:
@a8m I believe I can fix this one with a bit of guidance.
I've found that the issue is because the joined table (t1) is defined by the order logic and the pagination logic has no access to the table. In the generated code, the <Model>OrderField type's toTerm function defines the order and joins the table (wrapping sqlgraph.OrderByNeighborsCount or sqlgraph.OrderByNeighborTerms). Then in the pagination logic, on this line:
where the order table t1 should be used instead of s for accessing the column (s.C).
I believe the fix will require a somewhat substantial refactor to move the table join logic out of the ordering logic into a separate function so that the joined table (*sql.Table/*sql.Selector) can be returned and passed to both the order and pagination logic. I want to check with you before proceeding to check that this is the right course and to make sure that ordering without GQL pagination will work. What do you think? Any advice?
Current Behavior 馃槸
When ordering a connection using an edge order field and using a cursor offset, the constructed SQL query returns an error from the database.
For example:
GraphQL query:
Constructed SQL query:
Notice the
WHERE
clause references the columnother_models_count
on themy_model
table instead of ont1
. The query works fine without giving a cursor offset as noWHERE
clause is included on the SQL query. This issue happens when ordering by either type of edge order field: count and field (this example shows a count).I've also set the
engql.MultiOrder
annotation on these models if that is relevant.Expected Behavior 馃
The query should construct a SQL query that does not produce an error by referencing the subquery table for the edge order field instead of the main table. Should look like this:
Steps to Reproduce 馃暪
Entc options
Your Environment 馃寧
The text was updated successfully, but these errors were encountered: