[Django] #25049: Oracle constraints case sensitivity

34 views
Skip to first unread message

Django

unread,
Jul 2, 2015, 8:57:51 AM7/2/15
to django-...@googlegroups.com
#25049: Oracle constraints case sensitivity
-------------------------------------+-------------------------------------
Reporter: Pogsquog | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.8
(models, ORM) | Keywords: Oracle constraints
Severity: Normal | migration case
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
When using Oracle, migrations which alter the unique constraints of a
model do not migrate correctly. This appears to be due to a case
sensitivity difference in Oracle vs other databases.

Tested on Django 1.8 and 1.7 with Oracle 12c

example: models.py

from django.db import models

class DoorCount(models.Model):
Day = models.DateField()
MinuteOfTheDay = models.PositiveIntegerField()
DoorId = models.PositiveIntegerField(null=False, blank=False)
LineId = models.PositiveIntegerField(null=False, blank=False,
default=0)
Count = models.PositiveIntegerField(default=0)

class Meta:
# unique_together = ("Day", "MinuteOfTheDay", "DoorId", "LineId")
# migration initial 0001
unique_together = ("Day", "MinuteOfTheDay", "DoorId", "LineId") #
migration 0002

run makemigration with initial
run makemigration with 0002
run migrate
gets "Found wrong number (0) of constraints for TestApp_doorcount(Day,
MinuteOfTheDay, DoorId)"

Problem appears to be case sensitivity when looking for field names, so it
does not find the relevant constraint in the database.

Currently I have a workaround to patch site-packages/django/db/schema.py
with a .lower() on constraints, but this is very annoying for deploying,
and is probably better fixed in the oracle specific code.

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

Django

unread,
Jul 2, 2015, 10:29:01 AM7/2/15
to django-...@googlegroups.com
#25049: Oracle constraints case sensitivity
-------------------------------------+-------------------------------------
Reporter: Pogsquog | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Oracle constraints | Triage Stage:
migration case | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_docs: => 0
* easy: 1 => 0
* needs_tests: => 0
* needs_better_patch: => 0


Old description:

New description:

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25049#comment:1>

Django

unread,
Jul 2, 2015, 2:57:05 PM7/2/15
to django-...@googlegroups.com
#25049: Oracle constraints case sensitivity
-------------------------------------+-------------------------------------
Reporter: Pogsquog | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Oracle constraints | Triage Stage: Accepted
migration case |

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

* stage: Unreviewed => Accepted


Comment:

I haven't reproduced the issue myself, but it seems credible given #20487
and #24407.

--
Ticket URL: <https://code.djangoproject.com/ticket/25049#comment:2>

Django

unread,
Jul 9, 2016, 9:27:15 AM7/9/16
to django-...@googlegroups.com
#25049: Oracle constraints case sensitivity
-------------------------------------+-------------------------------------
Reporter: Pogsquog | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Oracle constraints | Triage Stage: Accepted
migration case |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

Could you check if #26833 fixed this?

--
Ticket URL: <https://code.djangoproject.com/ticket/25049#comment:3>

Django

unread,
Sep 23, 2016, 1:27:03 PM9/23/16
to django-...@googlegroups.com
#25049: Oracle fails to change unique_together constraints due to case sensitivity

-------------------------------------+-------------------------------------
Reporter: Pogsquog | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.8
Severity: Normal | Resolution: duplicate

Keywords: Oracle constraints | Triage Stage: Accepted
migration case |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* component: Database layer (models, ORM) => Migrations
* resolution: => duplicate


Comment:

Confirmed that #26833 fixed this.

--
Ticket URL: <https://code.djangoproject.com/ticket/25049#comment:4>

Reply all
Reply to author
Forward
0 new messages