Fixed #32686 -- Removed unnecessary semicolon on collected multiline SQL for RunSQL.

This commit is contained in:
Hannes Ljungberg 2021-04-26 13:51:10 +02:00 committed by Mariusz Felisiak
parent 95754dbc9b
commit eab71f7690
2 changed files with 2 additions and 1 deletions

View File

@ -135,7 +135,7 @@ class BaseDatabaseSchemaEditor:
# Log the command we're running, then run it
logger.debug("%s; (params %r)", sql, params, extra={'params': params, 'sql': sql})
if self.collect_sql:
ending = "" if sql.endswith(";") else ";"
ending = "" if sql.rstrip().endswith(";") else ";"
if params is not None:
self.collected_sql.append((sql % tuple(map(self.quote_value, params))) + ending)
else:

View File

@ -3007,6 +3007,7 @@ class OperationTests(OperationTestBase):
project_state = self.set_up_test_model('test_runsql')
new_state = project_state.clone()
tests = [
'INSERT INTO test_runsql_pony (pink, weight) VALUES (1, 1);\n',
'INSERT INTO test_runsql_pony (pink, weight) VALUES (1, 1)\n',
]
for sql in tests: