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
Given an M2M model which uses a db_column, the SQL code generated by django_cte does not account for the column name. I'd expect a CTE join to join on oid in the example below as that is the db_column value. But the join is specified on treenode_id.
I wonder if CTEColumn.as_sql could use ref.target.column like it does for "pk"? I think the challenge will be detecting when it is appropriate to use that vs using self.name. Not sure when I will have time to work on this, but pull requests are welcome 😃
For reference, here's a formatted version of the SQL from above with a comment detailing what was expected.
Given an M2M model which uses a
db_column
, the SQL code generated bydjango_cte
does not account for the column name. I'd expect a CTE join to join onoid
in the example below as that is thedb_column
value. But the join is specified ontreenode_id
.The issue arises, I think, here:
django-cte/django_cte/meta.py
Lines 61 to 68 in 61d5311
The code generated by django_cte does not account for the
db_column
Raises
The code generated by the queryset was:
The text was updated successfully, but these errors were encountered: