I want use the GinIndex method to create a gin index with the django's
migration. But while the migration, I have this errror :
{{{
django.db.utils.ProgrammingError : data type character varying has no
default operator class for access method "gin"
HINT : You must specify an operator class ofr the index or define a
default operator class for the data type.
}}}
This error may be resolved by enabling the btree_gin extension.
It is possible to pass the operator class during the index's creation ?
For example :
{{{
class Meta:
indexes = [
GinIndex(fields=['my_field'], name='my_index_gin',
operator_class='my_operator')
]
}}}
Thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/28077>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by erickzeto):
thanks for sharing!
I'll have a same problem!
Following topics
https://vehiclepad.com/favicon.png
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:1>
Comment (by Mads Jensen):
#27437 looks like it's overlapping a little bit.
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:2>
* stage: Unreviewed => Accepted
Comment:
I don't have much expertise here about the use cases and how this might
interact with #27437. Tentatively accepting for further investigation.
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:3>
Comment (by Mads Jensen):
https://github.com/mjtamlyn/django/blob/5ae3c70b405486fb81bcbf33b209f1301fade246/django/db/backends/postgresql/schema.py#L31-L35
so the issue of this may already being worked on?
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:4>
Comment (by vinay karanam):
I've a use case where I am always doing `__contains` query on `JSONField`.
So, I would prefer GIN index to be created using `jsonb_path_ops` operator
class rather than the default `jsonb_ops`.
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:5>
* owner: (none) => nobody
* has_patch: 0 => 1
* component: contrib.postgres => Database layer (models, ORM)
Comment:
#28783 was a duplicate and provides a
[https://github.com/django/django/pull/9332 PR].
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:6>
* owner: nobody => Ian Foote
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:7>
Comment (by Ian Foote):
I've noticed that in the
[https://github.com/django/django/blob/master/django/contrib/gis/db/backends/postgis/schema.py#L23-L41
postgis schema editor], we have custom index creation code for single-
field indexes for {{{geodetic}}} fields. For example, we set the
{{{GIST_GEOMETRY_OPS_ND}}} operator class for fields with dimension higher
than two.
It would probably be good to refactor to allow this custom code to
integrate with the operator class support I've added, but I'm not familiar
enough with postgis to be confident making a change without guidance.
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"38cada7c94f5f73d2d47a0a730ea5d71d266fa2c" 38cada7]:
{{{
#!CommitTicketReference repository=""
revision="38cada7c94f5f73d2d47a0a730ea5d71d266fa2c"
Fixed #28077 -- Added support for PostgreSQL opclasses in Index.
Thanks Vinay Karanam for the initial patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:9>
Comment (by GitHub <noreply@…>):
In [changeset:"82da72b74851808c08ec98fe609efe52609f29ad" 82da72b]:
{{{
#!CommitTicketReference repository=""
revision="82da72b74851808c08ec98fe609efe52609f29ad"
Refs #28077 -- Added opclasses to Index.__repr__().
This also removes unnecessary commas between attributes.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28077#comment:10>