Skip to content

Commit

Permalink
Skip ArrayField in exact conds
Browse files Browse the repository at this point in the history
Closes #489
  • Loading branch information
Suor committed Jan 10, 2025
1 parent f470975 commit 3eaa77e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cacheops/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Defaults:
CACHEOPS_SENTINEL = {}
# NOTE: we don't use this fields in invalidator conditions since their values could be very long
# and one should not filter by their equality anyway.
CACHEOPS_SKIP_FIELDS = "FileField", "TextField", "BinaryField", "JSONField"
CACHEOPS_SKIP_FIELDS = "FileField", "TextField", "BinaryField", "JSONField", "ArrayField"
CACHEOPS_LONG_DISJUNCTION = 8
CACHEOPS_SERIALIZER = 'pickle'

Expand Down
5 changes: 2 additions & 3 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,10 @@ def test_480(self):
conditions.append(reduce(operator.or_, queries))
list(queryset.filter(reduce(operator.and_, conditions)).cache())

@unittest.skipIf(connection.vendor != 'postgresql', "Only for PostgreSQL")
def test_489(self):
_ = TaggedPost.objects.create(meta={}, tags=[1, 2, 3])
tags = TaggedPost.objects.cache().exclude(tags=[])
TaggedPost.objects.cache().filter(tags=[]).count()

self.assertEqual(tags.count(), 1)

class RelatedTests(BaseTestCase):
fixtures = ['basic']
Expand Down

0 comments on commit 3eaa77e

Please sign in to comment.