Opened 7 years ago
Last modified 5 years ago
#29429 closed Bug
Postgres ArrayField doesn't work properly. — at Initial Version
Reported by: | creative3000 | Owned by: | nobody |
---|---|---|---|
Component: | contrib.postgres | Version: | 2.0 |
Severity: | Normal | Keywords: | db orm ArrayField postgres |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When you filter by len like in documentation example:
Post.objects.filter(tagslen=1)
But if you try to annotate something an error pops up example:
Post.objects.all().annotate(tag_len=F('tagslen'))
It really seems that it should work by default, but instead I needed to use something like this
Post.objects.all().annotate(tag_len=Func(F('tags'), 1, function='array_length'))
Note:
See TracTickets
for help on using tickets.