#31271: Logged ORM query differs from executed one
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
HansAarneLiblik |
Type: Bug | Status: new
Component: | Version: 3.0
Uncategorized | Keywords: oracle sql log
Severity: Normal | debug logging
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When making a query
{{{
MyObject.objects.filter(field1='value1').exclude(field2__in=['badValue1',
'badValue2'])
}}}
{{{
django/db/backends/oracle/base.py 'def _fix_for_params()'
}}}
gets params as
{{{
tuple('value1', 'badValue1', 'badValue2')
}}}
and then makes them into a set
{{{
enumerate(set(params))
}}}
. This changes the order of params, and assigns them key (i.e arg0, arg1,
..). This also changes the SQL query and replaces '%s' with param key's
(':arg0', ..). The order or param keys in SQL might not be in order
anymore.
After SQL is executed this statement is logged. But for logging in
{{{
django/db/backends/oracle/operations.py 'def last_executed_query()'
}}}
The code is replacing param keys in SQL (':arg0', ..) with params, but
they do not match anymore, since they are not in order in SQL statement
anymore
REproducable all the time with more than 1 param for SQL
--
Ticket URL: <https://code.djangoproject.com/ticket/31271>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/058.c4ad2867994df3ca0e41662c3d30f151%40djangoproject.com.