[Django] #16055: Filtering over funky generic relations breaks in postgres

67 views
Skip to first unread message

Django

unread,
May 19, 2011, 10:13:34 AM5/19/11
to django-...@googlegroups.com
#16055: Filtering over funky generic relations breaks in postgres
-----------------------+----------------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Database layer (models, ORM)
Version: 1.3 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
-----------------------+----------------------------------------------
When you have a generic foreign key with TextField / CharField object_id,
and try to use it in a filter with a model that has an integer primary
key, PostgreSQL 9.0.4 errors out with this:
{{{
DatabaseError: operator does not exist: integer = text

HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.
}}}

A small example:
{{{
class Tag(models.Model):
tag = models.SlugField()
content_type = models.ForeignKey(ContentType)
object_id = models.TextField()
content_object = generic.GenericForeignKey()

class Animal(models.Model):
name = models.TextField()
tags = generic.GenericRelation(Tag)

print Animal.objects.filter(tags__tag='mammal')
}}}

I have a patch that changes Django's generic foreign key tests to also try
everything with a textual object_id, which exhibits this problem.

A workaround is to create this cast as implicit in postgres:
{{{
CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16055>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 19, 2011, 10:21:27 AM5/19/11
to django-...@googlegroups.com
#16055: Filtering over funky generic relations breaks in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Database layer
Version: 1.3 | (models, ORM)
Resolution: | Severity: Normal
Triage Stage: | Keywords:
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by victor.van.den.elzen@…):

* cc: victor.van.den.elzen@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:1>

Django

unread,
May 23, 2011, 10:13:50 AM5/23/11
to django-...@googlegroups.com
#16055: Filtering over funky generic relations breaks in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Database layer
Version: 1.3 | (models, ORM)
Resolution: | Severity: Normal
Triage Stage: | Keywords:
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by joeri@…):

* cc: joeri@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:2>

Django

unread,
May 26, 2011, 11:52:37 AM5/26/11
to django-...@googlegroups.com
#16055: Filtering over funky generic relations breaks in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Database layer
Version: 1.3 | (models, ORM)
Resolution: | Severity: Normal
Triage Stage: Accepted | Keywords:
Needs documentation: 0 | Has patch: 0
Patch needs improvement: 0 | Needs tests: 0
| Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by ramiro):

* stage: Unreviewed => Accepted


Comment:

Replying to [ticket:16055 anonymous]:

> When you have a generic foreign key with TextField / CharField
object_id, and try to use it in a filter with a model that has an integer
primary key, PostgreSQL 9.0.4 errors out with this:
> {{{
> DatabaseError: operator does not exist: integer = text
>
> HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
> }}}
>
> A small example:

I've verified this specific test case by modifying tests already present
in the test suite (added in [12353]). See the attached patch.

I see no failure with Postgres 8.3 (the version in which cast behavior
changes were introduced). Can you please test it with Postgres 9 and post
the results?

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:3>

Django

unread,
Oct 2, 2015, 5:53:46 PM10/2/15
to django-...@googlegroups.com
#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
--------------------------------------+------------------------------------
Changes (by timgraham):

* component: Database layer (models, ORM) => contrib.contenttypes


Comment:

I updated the tests to apply cleanly to master and verified the failure on
PostgreSQL 9.4 at 58c7ff39fb265754fb17ab8d7f8a1401b355777b (Django
1.10.dev).
{{{
======================================================================
ERROR: test_charlink_filter
(generic_relations_regress.tests.GenericRelationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/code/django/tests/generic_relations_regress/tests.py",
line 57, in test_charlink_filter
list(OddRelation1.objects.filter(clinks__title='title'))
File "/home/tim/code/django/django/db/models/query.py", line 258, in
__iter__
self._fetch_all()
File "/home/tim/code/django/django/db/models/query.py", line 1074, in
_fetch_all
self._result_cache = list(self.iterator())
File "/home/tim/code/django/django/db/models/query.py", line 52, in
__iter__
results = compiler.execute_sql()
File "/home/tim/code/django/django/db/models/sql/compiler.py", line 839,
in execute_sql
cursor.execute(sql, params)
File "/home/tim/code/django/django/db/backends/utils.py", line 64, in
execute
return self.cursor.execute(sql, params)
File "/home/tim/code/django/django/db/utils.py", line 92, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/tim/code/django/django/db/backends/utils.py", line 64, in
execute
return self.cursor.execute(sql, params)
ProgrammingError: operator does not exist: integer = character varying
LINE 1: ...ON ("generic_relations_regress_oddrelation1"."id" = "generic...
^


HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:5>

Django

unread,
Oct 2, 2015, 5:54:01 PM10/2/15
to django-...@googlegroups.com
#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
--------------------------------------+------------------------------------
Changes (by timgraham):

* Attachment "16055-test.diff" added.

Django

unread,
Oct 2, 2015, 6:37:42 PM10/2/15
to django-...@googlegroups.com
#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 timgraham):

#20271 is a duplicate with an alternate test.

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:6>

Django

unread,
Jan 6, 2016, 10:13:02 AM1/6/16
to django-...@googlegroups.com
#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
--------------------------------------+------------------------------------
Changes (by mitar):

* cc: mmitar@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:7>

Django

unread,
Jan 6, 2016, 4:41:59 PM1/6/16
to django-...@googlegroups.com
#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
--------------------------------------+------------------------------------
Changes (by brian):

* cc: brian@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:8>

Django

unread,
Apr 11, 2018, 2:41:56 AM4/11/18
to django-...@googlegroups.com
#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
--------------------------------------+------------------------------------
Changes (by Kye Russell):

* cc: Kye Russell (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:9>

Django

unread,
Dec 17, 2019, 2:35:53 PM12/17/19
to django-...@googlegroups.com
#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
--------------------------------------+------------------------------------
Changes (by Kevin Wiliarty):

* cc: Kevin Wiliarty (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:10>

Django

unread,
Dec 17, 2019, 4:42:44 PM12/17/19
to django-...@googlegroups.com
#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

unread,
Feb 18, 2020, 6:41:12 AM2/18/20
to django-...@googlegroups.com
#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 Nekmo):

I have made a hack for Django-guardian. In my case, this query is the one
that fails:


{{{
from customers.models import CustomerMemberObjectPermission

CustomerMemberObjectPermission.objects.filter(service_api__service__service_name='foo')
# Raise DatabaseError
}}}

My models:

{{{
class CustomerMemberObjectPermission(UserObjectPermission):
objects = CustomerMemberObjectPermissionManager()


class ServiceApi(Model):
customer_permissions = GenericRelation(CustomerMemberObjectPermission,
object_id_field='object_pk',
related_query_name='service_api')
}}}

This is the wrong sql:
{{{
SELECT "guardian_userobjectpermission"."id",
"guardian_userobjectpermission"."permission_id",
"guardian_userobjectpermission"."content_type_id",
"guardian_userobjectpermission"."object_pk",
"guardian_userobjectpermission"."user_id" FROM
"guardian_userobjectpermission" INNER JOIN "services_serviceapi" ON
("guardian_userobjectpermission"."object_pk" = "services_serviceapi"."id"
AND ("guardian_userobjectpermission"."content_type_id" = 22)) INNER JOIN
"services_service" ON ("services_serviceapi"."service_id" =
"services_service"."id") INNER JOIN "customers_customer" ON
("services_service"."customer_id" = "customers_customer"."id") WHERE
"customers_customer"."customer_code" = BCL
}}}

The error is in the inner join. Django-guardian uses a field of type
string for object_pk. But my id is a integer type:
{{{
"guardian_userobjectpermission"."object_pk" = "services_serviceapi"."id"
}}}

The solution is to use a cast:
{{{
CAST("guardian_userobjectpermission"."object_pk" AS integer) =
"services_serviceapi"."id"
}}}

Although I know it is not the best, my solution has been this hack thanks
to Simon Charette:
{{{
class CustomJoin(Join):
def as_sql(self, compiler, connection):
sql, params = super(CustomJoin, self).as_sql(compiler, connection)
sql = sql.replace('"guardian_userobjectpermission"."object_pk"',
'CAST("guardian_userobjectpermission"."object_pk" AS integer)')
return sql, params


class CustomSQLCompiler(SQLCompiler):
def compile(self, node, select_format=False):
if isinstance(node, Join):
node = CustomJoin(
node.table_name, node.parent_alias, node.table_alias,
node.join_type,
node.join_field, node.nullable, node.filtered_relation
)
return super(CustomSQLCompiler, self).compile(node, select_format)


class CustomQuery(Query):
def get_compiler(self, using=None, connection=None):
original_compiler = super(CustomQuery,
self).get_compiler(using=using, connection=connection)
return CustomSQLCompiler(original_compiler.query,
original_compiler.connection, original_compiler.using)
# return super(CustomQuery, self).get_compiler(using=using,
connection=connection)


class CustomerMemberObjectPermissionQuerySet(CustomerQuerySet):
def __init__(self, model=None, query=None, using=None, hints=None):
if not query:
query = CustomQuery(model)
super(CustomerMemberObjectPermissionQuerySet, self).__init__(
model=model, query=query, using=using, hints=hints
)


class CustomerMemberObjectPermissionManager(CustomerManager,
UserObjectPermissionManager):
def get_queryset(self):
return CustomerMemberObjectPermissionQuerySet(self.model,
using=self._db)
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:12>

Django

unread,
Feb 24, 2021, 3:15:53 PM2/24/21
to django-...@googlegroups.com
#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):

Note that another elegant solution to this problem could be to add support
to transforms to `ForeignObject.to_fields` and `.from_fields` so you could
do something along these lines

{{{#!python


class Animal(models.Model):
name = models.TextField()

tags = generic.GenericRelation(Tag, from_field='id__text')
}}}

(assuming we'd register a `__text` lookup for `IntegerField`)

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:13>

Django

unread,
Apr 21, 2021, 7:57:07 AM4/21/21
to django-...@googlegroups.com
#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 Marc DEBUREAUX):

Manage to create something based on Simon Charette's suggestion.

Creating a custom `GenericRelation` with the following:
- `get_joining_columns` returning an empty tuple
- `get_extra_restriction` building the whole where clause with content
type **AND** primary key join with Cast

Here's the result:

{{{#!python
class CustomGenericRelation(GenericRelation):
def get_joining_columns(self, reverse_join=False):
joining_columns = super().get_joining_columns(reverse_join)
self.joining_columns = joining_columns
return tuple()

def get_extra_restriction(self, where_class, alias, remote_alias):
cond = super().get_extra_restriction(where_class, alias,
remote_alias)
from_field = self.model._meta.pk
to_field =
self.remote_field.model._meta.get_field(self.object_id_field_name)
lookup = from_field.get_lookup('exact')(
Cast(from_field.get_col(alias),
output_field=models.TextField()),
to_field.get_col(remote_alias))
cond.add(lookup, 'AND')
return cond
}}}

Giving the following:
- a model `common.History` having a `GenericForeignKey` with `object_id`
as text
- a model `generic.Twitter` having a `CustomGenericRelation` and a numeric
primary key
- and the queryset:

{{{#!python
q =
Twitter.objects.values('id').filter(id=1).annotate(count=Count('histories'))
print(q.query)
}}}

It gives the following SQL query:

{{{#!sql
SELECT
"generic_twitter"."id",
COUNT("common_history"."id") AS "count"
FROM "generic_twitter"
LEFT OUTER JOIN "common_history" ON
(((
"common_history"."content_type_id" = 29 AND
CAST("generic_twitter"."id" AS text) = "common_history"."object_id"
)))
WHERE "generic_twitter"."id" = 1
GROUP BY "generic_twitter"."id"
}}}

Instead of this one (normal behaviour):

{{{#!sql
SELECT
"generic_twitter"."id",
COUNT("common_history"."id") AS "count"
FROM "generic_twitter"
LEFT OUTER JOIN "common_history" ON
(
"generic_twitter"."id" = "common_history"."object_id" AND
("common_history"."content_type_id" = 29)
)
WHERE "generic_twitter"."id" = 1
GROUP BY "generic_twitter"."id"
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:14>

Django

unread,
Apr 21, 2021, 11:23:45 AM4/21/21
to django-...@googlegroups.com
#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: 3.2

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
--------------------------------------+------------------------------------
Changes (by Marc DEBUREAUX):

* cc: Marc DEBUREAUX (added)
* version: 1.3 => 3.2


Comment:

Change Django version number for visibility purposes.

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:15>

Django

unread,
Dec 21, 2022, 1:07:00 PM12/21/22
to django-...@googlegroups.com
#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: 3.2
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
--------------------------------------+------------------------------------
Changes (by Sage Abdullah):

* cc: Sage Abdullah (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:16>

Django

unread,
Mar 7, 2023, 8:09:12 AM3/7/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* cc: David Wobrock (added)
* owner: nobody => David Wobrock
* has_patch: 0 => 1
* status: new => assigned


Comment:

[https://github.com/django/django/pull/16632 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:17>

Django

unread,
Mar 8, 2023, 2:58:00 AM3/8/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


Comment:

Per Simon's comments.

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:18>

Django

unread,
Mar 8, 2023, 11:39:18 AM3/8/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:19>

Django

unread,
Mar 10, 2023, 7:01:16 AM3/10/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:20>

Django

unread,
Mar 11, 2023, 1:31:39 PM3/11/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:21>

Django

unread,
Mar 14, 2023, 3:35:02 AM3/14/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:22>

Django

unread,
Apr 10, 2023, 7:21:54 AM4/10/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* needs_better_patch: 1 => 0

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:23>

Django

unread,
Apr 11, 2023, 3:47:01 AM4/11/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:24>

Django

unread,
Apr 18, 2023, 2:55:22 AM4/18/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:25>

Django

unread,
Apr 18, 2023, 6:57:52 AM4/18/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: assigned
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:26>

Django

unread,
Apr 18, 2023, 9:51:29 AM4/18/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: closed
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"9bbf97bcdb488bb11aebb5bd405549fbec6852cd" 9bbf97bc]:
{{{
#!CommitTicketReference repository=""
revision="9bbf97bcdb488bb11aebb5bd405549fbec6852cd"
Fixed #16055 -- Fixed crash when filtering against char/text
GenericRelation relation on PostgreSQL.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:27>

Django

unread,
Apr 18, 2023, 9:51:29 AM4/18/23
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: closed
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"8b1ff0da4b162e87edebd94e61f2cd153e9e159d" 8b1ff0da]:
{{{
#!CommitTicketReference repository=""
revision="8b1ff0da4b162e87edebd94e61f2cd153e9e159d"
Refs #16055 -- Deprecated
get_joining_columns()/get_reverse_joining_columns() methods.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:28>

Django

unread,
Aug 28, 2024, 10:44:14 AM8/28/24
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: closed
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"8ee17037ae706178040a7fc821789e4358ea9287" 8ee17037]:
{{{#!CommitTicketReference repository=""
revision="8ee17037ae706178040a7fc821789e4358ea9287"
Refs #16055 -- Adjusted deprecation warning stacklevel in
get_joining_columns()/get_reverse_joining_columns().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:29>

Django

unread,
Jan 15, 2025, 4:28:48 PMJan 15
to django-...@googlegroups.com
#16055: Filtering over generic relations with TextField/CharField object_id breaks
in postgres
-------------------------------------+-------------------------------------
Reporter: anonymous | Owner: David
| Wobrock
Type: Bug | Status: closed
Component: | Version: 3.2
contrib.contenttypes |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

In [changeset:"0a0f9b4acce5534c1e1da145f80856f5e6b78768" 0a0f9b4a]:
{{{#!CommitTicketReference repository=""
revision="0a0f9b4acce5534c1e1da145f80856f5e6b78768"
Refs #16055 -- Removed get_joining_columns()/get_reverse_joining_columns()
methods per deprecation timeline.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16055#comment:30>
Reply all
Reply to author
Forward
0 new messages