Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #17513 -- Prevented the MySQL backend from leaking MySQLdb-spec…

…ific exceptions. Thanks Claude Paroz.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent f460035 commit ca187fea88b626508e125e0843c991fe63f8ed95 @aaugustin aaugustin committed
2  django/db/backends/mysql/
@@ -119,7 +119,7 @@ def executemany(self, query, args):
# misclassified and Django would prefer the more logical place.
if e[0] in self.codes_for_integrityerror:
raise utils.IntegrityError, utils.IntegrityError(*tuple(e)), sys.exc_info()[2]
- raise
+ raise utils.DatabaseError, utils.DatabaseError(*tuple(e)), sys.exc_info()[2]
except Database.DatabaseError, e:
raise utils.DatabaseError, utils.DatabaseError(*tuple(e)), sys.exc_info()[2]
6 tests/regressiontests/backends/
@@ -351,6 +351,12 @@ def test_database_operations_helper_class(self):
self.assertTrue(hasattr(connection.ops, 'connection'))
self.assertEqual(connection, connection.ops.connection)
+ def test_duplicate_table_error(self):
+ """ Test that creating an existing table returns a DatabaseError """
+ cursor = connection.cursor()
+ query = 'CREATE TABLE %s (id INTEGER);' % models.Article._meta.db_table
+ with self.assertRaises(DatabaseError):
+ cursor.execute(query)
# We don't make these tests conditional because that means we would need to
# check and differentiate between:

0 comments on commit ca187fe

Please sign in to comment.
Something went wrong with that request. Please try again.