Fix a regression with executing SQL containing '%' characters.
Review Request #11106 — Created July 30, 2020 and submitted
The new code for normalizing SQL statements and executing them ensured
that the parameters passed in to
cursor.execute()was always a
tuple, even if empty. This wasn't correct, since it would trigger an
attempt at string interpolation any time the SQL contained a
character (such as in a
Normally, it'd be up to the caller to either escape the
%, or to
Noneas parameters to the statement. These were, in fact,
None, and we were converting tha to an empty tuple. This change
fixes this behavior so that we preserve the type of the parameters
provided by the caller.
Unit tests pass on all supported versions of Django and on all
Encountered this with the upcoming work on constraint support. Verified
that this no longer triggered crashes executing SQL.