{{{
class Man(Model):
id = models.AutoField(primary_key=True, db_column="F_MAN_ID")
}}}
Then it is impossible to use RawQuerySets with this model on Oracle, you
will always get the “InvalidQuery: Raw query must include the primary key”
error.
The problem is that {{{column_name_converter()}}} converts the column
names to lowercase, so even if you use {{{F_MAN_ID}}} in your query, the
{{{self.columns}}} list in the RawQuerySet instance will contain the
lowercase column name. And because of case differences the {{{f.column in
self.columns}}} check in {{{resolve_model_init_order}}} method will return
False.
We are currently using Django 1.8 in production, but I looked at the
Django code and it’s the same between 1.8 and 1.11, so I have put 1.11
into the Version field.
--
Ticket URL: <https://code.djangoproject.com/ticket/28206>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "28206.diff" added.
Test
* keywords: => Oracle
* version: 1.11 => master
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/28206#comment:1>
* status: new => assigned
* owner: nobody => felixxm
--
Ticket URL: <https://code.djangoproject.com/ticket/28206#comment:2>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/8511 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/28206#comment:3>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/28206#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"99df304c856ac2f6ee18418ea8ca3e2dc7b47dac" 99df304]:
{{{
#!CommitTicketReference repository=""
revision="99df304c856ac2f6ee18418ea8ca3e2dc7b47dac"
Fixed #28206 -- Fixed RawQuerySet crash on a model with a mixed case
db_column pk on Oracle.
Thanks Tim Graham for the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28206#comment:5>