#16055: Filtering over generic relations with TextField/CharField object_id
breaks
in postgres
--------------------------------------+------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Simon Charette):
If anyone is interested in addressing this issue it should be doable by
adjusting `Join.as_sql` to add the appropriate cast when `lhs_col` and
`rhs_col`'s `.db_type(connection)` doesn't match.
https://github.com/django/django/blob/129583a0d3cf69b08d058cd751d777588801b7ad/django/db/models/sql/datastructures.py#L70-L77
Ideally most of the `Cast` logic would be moved to the database backend
operations so `Join.as_sql` can rely on it instead of having to depend on
`db.models` stuff.
A less invasive solution would be to make `GenericRelation`'s `join_field`
return an empty `get_joining_columns` and include the adapted condition in
`get_extra_restriction` instead but that seems like this should be solved
at the `Join` level instead since we don't offer a low level way of
completely configuring join conditions; we only allow to augment them
using `FilteredRelation`.
--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.b976177ce18117d6d3b630738f033b04%40djangoproject.com.