Opened 5 years ago

Last modified 7 weeks ago

#30200 new New feature

Add support for using indexes in update() for ArrayFields.

Reported by: Mariusz Felisiak Owned by:
Component: contrib.postgres Version: dev
Severity: Normal Keywords: ArrayField PostreSQL index update
Cc: Ülgen Sarıkavak Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django supports index lookup for ArrayFields (see docs). I think we should support them also in update(), e.g.

Foo.objects.update(bar_array_field__0='random text')
Foo.objects.update(bar_array_field__0=F('other_related_field'))

I know that 3rd party packages already support this e.g. django_postgres_extensions, but IMO we should add this to Django.

Change History (8)

comment:1 by Carlton Gibson, 5 years ago

Triage Stage: UnreviewedAccepted

OK. Seems reasonable.

comment:2 by Tim Graham, 5 years ago

See also #24709 for using QuerySet.update() without indexes.

comment:3 by Nasir Hussain, 5 years ago

Owner: set to Nasir Hussain
Status: newassigned

comment:4 by Nasir Hussain, 5 years ago

Has patch: set

Created a PR.

comment:5 by Mariusz Felisiak, 4 years ago

Patch needs improvement: set

comment:6 by Abhyudai, 3 years ago

Has patch: unset
Owner: changed from Nasir Hussain to Abhyudai
Patch needs improvement: unset

comment:7 by Mariusz Felisiak, 2 years ago

Owner: Abhyudai removed
Status: assignednew

comment:8 by Ülgen Sarıkavak, 7 weeks ago

Cc: Ülgen Sarıkavak added
Note: See TracTickets for help on using tickets.
Back to Top