diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-12-01 11:13:01 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-12-02 09:02:54 +0100 |
| commit | 3a42d9730cbb07ffbb983791e631f5d0a6746f68 (patch) | |
| tree | 79d5d29198c335f398fb1c17a634ce04ea992700 /django/db | |
| parent | bc5bb3e1a0fd8e4641eafa263e6e5871198fbff4 (diff) | |
[1.7.x] Fixed #23909 -- Prevented crash when collecting SQL for RunSQL
Thanks James Rivett-Carnac for the report and Markus Holtermann
for the review.
Backport of e11c6fd21 from master.
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/backends/schema.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py index 64ba5b0740..4fc6601dfd 100644 --- a/django/db/backends/schema.py +++ b/django/db/backends/schema.py @@ -93,7 +93,11 @@ class BaseDatabaseSchemaEditor(object): # Log the command we're running, then run it logger.debug("%s; (params %r)" % (sql, params)) if self.collect_sql: - self.collected_sql.append((sql % tuple(map(self.quote_value, params))) + ";") + ending = "" if sql.endswith(";") else ";" + if params is not None: + self.collected_sql.append((sql % tuple(map(self.quote_value, params))) + ending) + else: + self.collected_sql.append(sql + ending) else: with self.connection.cursor() as cursor: cursor.execute(sql, params) |
