diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2016-01-09 21:30:19 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2016-01-21 10:47:15 +0100 |
| commit | f91b5a7e4b2ac436b1fe3065b23217543d0f54c1 (patch) | |
| tree | de35279fa5162111654cc04d706db5ecf78217ca /tests | |
| parent | ee596888e1149864e7828f5cf63c0eda395744c3 (diff) | |
Fixed #26063 -- Crash when passing > 2000 params.
If SQLITE_MAX_VARIABLE_NUMBER (default = 999) is changed at compile time
to be greater than SQLITE_MAX_COLUMN (default = 2000), which Debian does
by setting the former to 250000, Django raised an exception on queries
containing more than 2000 parameters when DEBUG = True.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/backends/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py index 693bb77180..460b522079 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -426,6 +426,18 @@ class LastExecutedQueryTest(TestCase): substituted = "SELECT '\"''\\'" self.assertEqual(connection.queries[-1]['sql'], substituted) + @unittest.skipUnless(connection.vendor == 'sqlite', + "This test is specific to SQLite.") + def test_large_number_of_parameters_on_sqlite(self): + # If SQLITE_MAX_VARIABLE_NUMBER (default = 999) has been changed to be + # greater than SQLITE_MAX_COLUMN (default = 2000), last_executed_query + # can hit the SQLITE_MAX_COLUMN limit. See #26063. + cursor = connection.cursor() + sql = "SELECT MAX(%s)" % ", ".join(["%s"] * 2001) + params = list(range(2001)) + # This should not raise an exception. + cursor.db.ops.last_executed_query(cursor.cursor, sql, params) + class ParameterHandlingTest(TestCase): |
