mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #28206 -- Fixed RawQuerySet crash on a model with a mixed case db_column pk on Oracle.
Thanks Tim Graham for the review.
This commit is contained in:
parent
98b3b14a64
commit
99df304c85
3 changed files with 19 additions and 3 deletions
|
@ -32,6 +32,10 @@ class Coffee(models.Model):
|
|||
price = models.DecimalField(max_digits=10, decimal_places=2, default=0)
|
||||
|
||||
|
||||
class MixedCaseIDColumn(models.Model):
|
||||
id = models.AutoField(primary_key=True, db_column='MiXeD_CaSe_Id')
|
||||
|
||||
|
||||
class Reviewer(models.Model):
|
||||
reviewed = models.ManyToManyField(Book)
|
||||
|
||||
|
|
|
@ -5,7 +5,10 @@ from django.db.models.query import RawQuerySet
|
|||
from django.db.models.query_utils import InvalidQuery
|
||||
from django.test import TestCase, skipUnlessDBFeature
|
||||
|
||||
from .models import Author, Book, BookFkAsPk, Coffee, FriendlyAuthor, Reviewer
|
||||
from .models import (
|
||||
Author, Book, BookFkAsPk, Coffee, FriendlyAuthor, MixedCaseIDColumn,
|
||||
Reviewer,
|
||||
)
|
||||
|
||||
|
||||
class RawQueryTests(TestCase):
|
||||
|
@ -129,6 +132,14 @@ class RawQueryTests(TestCase):
|
|||
coffees = Coffee.objects.all()
|
||||
self.assertSuccessfulRawQuery(Coffee, query, coffees)
|
||||
|
||||
def test_pk_with_mixed_case_db_column(self):
|
||||
"""
|
||||
A raw query with a model that has a pk db_column with mixed case.
|
||||
"""
|
||||
query = "SELECT * FROM raw_query_mixedcaseidcolumn"
|
||||
queryset = MixedCaseIDColumn.objects.all()
|
||||
self.assertSuccessfulRawQuery(MixedCaseIDColumn, query, queryset)
|
||||
|
||||
def test_order_handler(self):
|
||||
"""
|
||||
Test of raw raw query's tolerance for columns being returned in any
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue