1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #32158 -- Fixed loaddata crash on SQLite when table/column names are SQL keywords.

This commit is contained in:
Chinmoy Chakraborty
2020-12-28 11:15:48 +05:30
committed by Mariusz Felisiak
parent 89fc144ded
commit 270072c4c2
3 changed files with 28 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ from django.test import (
from .models import (
Article, Object, ObjectReference, Person, Post, RawData, Reporter,
ReporterProxy, SchoolClass, Square,
ReporterProxy, SchoolClass, SQLKeywordsModel, Square,
VeryLongModelNameZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ,
)
@@ -625,6 +625,17 @@ class FkConstraintsTests(TransactionTestCase):
connection.check_constraints()
transaction.set_rollback(True)
def test_check_constraints_sql_keywords(self):
with transaction.atomic():
obj = SQLKeywordsModel.objects.create(reporter=self.r)
obj.refresh_from_db()
obj.reporter_id = 30
with connection.constraint_checks_disabled():
obj.save()
with self.assertRaises(IntegrityError):
connection.check_constraints(table_names=['order'])
transaction.set_rollback(True)
class ThreadTests(TransactionTestCase):