Opened 2 months ago

Closed 3 weeks ago

#28783 closed New feature (duplicate)

Allow specifying custom operator classes for PostgreSQL indexes

Reported by: vinay karanam Owned by: nobody
Component: Database layer (models, ORM) Version: 2.0
Severity: Normal Keywords: postgres, operator class
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is an extension of #28077 to support specifying operator class for indexes.

Usage:

Index(fields=['jsonfield'], index_name='jsonb_idx', operator_class='jsonb_path_ops')

Change History (6)

comment:1 Changed 2 months ago by Tim Graham

Is this only supported on PostgreSQL? Of course, documentation would also be needed.

comment:2 Changed 2 months ago by vinay karanam

AFAICT, this is only supported on psql. I am unable to find similar feature on other databases.

I've updated the corresponding documentation.

comment:3 Changed 6 weeks ago by Sergey Fedoseev

Has patch: set
Last edited 3 weeks ago by Tim Graham (previous) (diff)

comment:4 Changed 3 weeks ago by Tim Graham

Is there a need for a separate ticket from #28077? (Is there some additional work needed to close that or could we just retitle it?)

I'm unsure if adding database-specific kwargs like operator_class to Index.__init__() is a good approach, but I don't have an alternative in mind.

comment:5 Changed 3 weeks ago by vinay karanam

#28077 requires almost same amount of work. It is only asking operator support for GinIndex, whereas this adds support for any postgres index. We can close it in favour of this or retitle #28077 and close this ticket.

Regarding code changes, even I was skeptical at first about adding operator_class to Index.__init__() but then I saw Index.create_sql accepts using kwarg which is only valid for postgres index.
If necessary we can have a subclass PGIndex and move postgres specific options into this.

comment:6 Changed 3 weeks ago by Tim Graham

Resolution: duplicate
Status: newclosed
Summary: Support for custom operator class for indexesAllow specifying custom operator classes for PostgreSQL indexes

Okay, I added the details from this ticket to #28077 and retitled it.

Note: See TracTickets for help on using tickets.
Back to Top