Opened 18 months ago

Last modified 7 months ago

#30200 assigned New feature

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

Reported by: felixxm Owned by: Nasir Hussain
Component: contrib.postgres Version: master
Severity: Normal Keywords: ArrayField PostreSQL index update
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
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 (5)

comment:1 Changed 18 months ago by Carlton Gibson

Triage Stage: UnreviewedAccepted

OK. Seems reasonable.

comment:2 Changed 18 months ago by Tim Graham

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

comment:3 Changed 12 months ago by Nasir Hussain

Owner: set to Nasir Hussain
Status: newassigned

comment:4 Changed 11 months ago by Nasir Hussain

Has patch: set

Created a PR.

comment:5 Changed 7 months ago by felixxm

Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top