#28206: Raw queries with Oracle impossible when using uppercase column names -------------------------------------+------------------------------------- Reporter: mitya57 | Owner: nobody Type: Bug | Status: new Component: Database | Version: 1.11 layer (models, ORM) | Severity: Normal | Keywords: Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- When one has a model with a custom column name in uppercase, say:
{{{ 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. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.58536b2c3039ce5a1d98ebdcf32c5f57%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.