Opened 2 years ago

Closed 20 months ago

Last modified 20 months ago

#27135 closed Cleanup/optimization (fixed)

Standardise type value returned by introspection.get_constraints for indexes

Reported by: Akshesh Doshi Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: introspection db-indexes 1.11
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, Django supports introspection of index type for PostgreSQL and would be supporting it for other backends as well in future.

Currently the value returned for type is arbitrary but it would be better to set a standard values associated with each index types (like using Index.suffix as suggested by Tim Graham). This discussion might make it more clear - https://github.com/django/django/pull/7046#discussion-diff-74431956

Change History (5)

comment:1 Changed 2 years ago by Tim Graham

Keywords: db-indexes 1.11 added
Triage Stage: UnreviewedAccepted

comment:2 Changed 20 months ago by Tim Graham

To address this for 1.11, I think all that's involved is having Django's database introspection return 'idx' (Index.suffix) instead of 'btree'. It looks like the other indexes (brin/gin for PostgreSQL) are already returning Index.suffix.

Functionality wise, nothing changes since inspectdb doesn't consider indexes yet (#27060) but this will set expectations for third-party database backends and prevent them from having to change in a future Django release.

comment:3 Changed 20 months ago by Tim Graham

Has patch: set

comment:4 Changed 20 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In b008f7c:

Fixed #27135 -- Made index introspection return Index.suffix.

comment:5 Changed 20 months ago by Tim Graham <timograham@…>

In 2f6cdc0:

[1.11.x] Fixed #27135 -- Made index introspection return Index.suffix.

Backport of b008f7cc5655d01817a8825e6317877b43c92181 from master

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