Re: [Django] #12400: column "X" named in key does not exist error when models.PointField used in unique_together

20 views
Skip to first unread message

Django

unread,
Apr 15, 2012, 1:05:31 PM4/15/12
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+--------------------------------------------------
Reporter: monkut | Owner: jbronn
Type: Bug | Status: new
Component: GIS | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design decision needed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+--------------------------------------------------
Changes (by ckarrie):

* cc: ckarrie@… (added)
* version: 1.1 => SVN


Comment:

Same in Postgis 2.0

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 23, 2013, 3:36:42 AM3/23/13
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+------------------------------------
Reporter: monkut | Owner: jbronn
Type: Bug | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------
Changes (by aaugustin):

* stage: Design decision needed => Accepted


Comment:

If this isn't fixed, it should at least be documented.

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:8>

Django

unread,
Mar 21, 2015, 1:09:03 PM3/21/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: assigned

Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------
Changes (by claudep):

* owner: jbronn => claudep
* status: new => assigned
* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/4361

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:9>

Django

unread,
Mar 23, 2015, 8:12:34 AM3/23/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+---------------------------------------------

Reporter: monkut | Owner: claudep
Type: Bug | Status: assigned
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+---------------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:10>

Django

unread,
Mar 23, 2015, 2:53:30 PM3/23/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+---------------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: closed
Component: GIS | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+---------------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"01ec127baec38b7f8281e6eca9def40f22c9e5ad" 01ec127b]:
{{{
#!CommitTicketReference repository=""
revision="01ec127baec38b7f8281e6eca9def40f22c9e5ad"
Fixed #12400 -- Allowed geometry fields in unique_together

Thanks Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:11>

Django

unread,
Mar 23, 2015, 5:43:23 PM3/23/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: new

Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------
Changes (by timgraham):

* status: closed => new
* has_patch: 1 => 0
* resolution: fixed =>
* stage: Ready for checkin => Accepted


Comment:

Crash on Oracle after this change:
{{{
Traceback (most recent call last):
File "./runtests.py", line 434, in <module>
options.debug_sql)
File "./runtests.py", line 256, in django_tests
extra_tests=extra_tests,
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/test/runner.py",
line 210, in run_tests
old_config = self.setup_databases()
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/test/runner.py",
line 166, in setup_databases
**kwargs
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/test/runner.py",
line 370, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE",
True),
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/db/backends/base/creation.py",
line 71, in create_test_db
run_syncdb=True,
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/core/management/__init__.py",
line 118, in call_command
return command.execute(*args, **defaults)
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/core/management/base.py",
line 398, in execute
output = self.handle(*args, **options)
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/core/management/commands/migrate.py",
line 168, in handle
self.sync_apps(connection, executor.loader.unmigrated_apps)
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/core/management/commands/migrate.py",
line 288, in sync_apps
cursor.execute(statement)
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/db/backends/utils.py",
line 64, in execute
return self.cursor.execute(sql, params)
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/db/utils.py",
line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/db/backends/utils.py",
line 62, in execute
return self.cursor.execute(sql)
File "/home/jenkins/workspace/django-
oracle/database/oragis11/label/trusty/python/python2.7/django/db/backends/oracle/base.py",
line 478, in execute
return self.cursor.execute(query, self._param_generator(params))
django.db.utils.DatabaseError: ORA-02329: column of datatype ADT cannot be
unique or a primary key
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:12>

Django

unread,
Mar 24, 2015, 3:47:03 AM3/24/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------

Comment (by claudep):

Does that mean that Oracle doesn't support unique indexes on geometry
fields? If that's the case, we'll probably need a new database feature.
Then the difficulty will be to conditionally create the index during
tests. As usual, I'm not able to work on Oracle fixes, but I'm available
to discuss/help.

More generally, being able to skip some model import or creation depending
on the backend would be useful for other tests too (gis, postgres, etc.).

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:13>

Django

unread,
Apr 22, 2015, 2:13:13 PM4/22/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: 1.9 | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------
Changes (by timgraham):

* keywords: => 1.9


--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:14>

Django

unread,
Aug 19, 2015, 6:05:01 AM8/19/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: 1.9 | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------

Comment (by jtiai):

Yes, Oracle doesn't support unique index on geometry fields so this must
be resolved so that models and tests are skipped on Oracle by some means.

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:15>

Django

unread,
Aug 19, 2015, 9:03:48 AM8/19/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: 1.9 | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+------------------------------------

Comment (by akaariai):

Could you make the unique index definition conditional on used database,
and the skip the tests that require the index by normal means?
Alternatively you can make the model definition conditional on db, but
that requires conditional imports, too.

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:16>

Django

unread,
Aug 19, 2015, 4:20:34 PM8/19/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+---------------------------------------------

Reporter: monkut | Owner: claudep
Type: Bug | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: 1.9 | Triage Stage: Ready for checkin

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+---------------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


Comment:

[https://github.com/django/django/pull/5160 Pull request] looks good
(pending some cosmetic edits).

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:17>

Django

unread,
Aug 19, 2015, 7:08:25 PM8/19/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+---------------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+---------------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"1b8d7eff3bb1de1f0b51137d720d6fcf7622bced" 1b8d7eff]:
{{{
#!CommitTicketReference repository=""
revision="1b8d7eff3bb1de1f0b51137d720d6fcf7622bced"
Refs #12400 -- Added supports_geometry_field_unique_index GIS db feature.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:18>

Django

unread,
Aug 19, 2015, 7:10:21 PM8/19/15
to django-...@googlegroups.com
#12400: column "X" named in key does not exist error when models.PointField used in
unique_together
------------------------+---------------------------------------------
Reporter: monkut | Owner: claudep
Type: Bug | Status: closed
Component: GIS | Version: master
Severity: Normal | Resolution: fixed

Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+---------------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/12400#comment:19>

Reply all
Reply to author
Forward
0 new messages