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:
committed by
Mariusz Felisiak
parent
89fc144ded
commit
270072c4c2
@@ -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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user