Re: [Django] #36112: DatabaseOperations.format_debug_sql() crashes when query fails to execute on some backends

3 views
Skip to first unread message

Django

unread,
Jan 22, 2025, 4:49:35 AMJan 22
to django-...@googlegroups.com
#36112: DatabaseOperations.format_debug_sql() crashes when query fails to execute
on some backends
-----------------------------------+--------------------------------------
Reporter: Jacob Walls | Owner: Tim Graham
Type: Bug | Status: assigned
Component: Testing framework | Version: dev
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by Mariusz Felisiak):

> ... or `DatabaseOperations.last_executed_query()` subclass
implementations could fall back to
​`BaseDatabaseOperations.last_executed_query()` rather than returning
`None`.

This sound like a great idea for me.
--
Ticket URL: <https://code.djangoproject.com/ticket/36112#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 13, 2025, 9:10:04 AMJun 13
to django-...@googlegroups.com
#36112: DatabaseOperations.format_debug_sql() crashes when query fails to execute
on some backends
-----------------------------------+--------------------------------------
Reporter: Jacob Walls | Owner: Tim Graham
Type: Bug | Status: assigned
Component: Testing framework | Version: dev
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by Natalia Bidart):

I believe my work from ticket #36380
(https://github.com/django/django/pull/19512) solves the reported crash
since `format_debug_sql` is no longer called on the result of
`last_executed_query`. The new `SQLFormatter` would only call
`format_debug_sql` for truthy values of SQL, so, strictly speaking, the
ticket would be solved. Though, I understand that there is a desire to
make further improvements to `last_executed_query`, in that case, we could
downgrade this ticket to not-release-blocker and repurpose it. What do you
all think?
--
Ticket URL: <https://code.djangoproject.com/ticket/36112#comment:8>
Reply all
Reply to author
Forward
0 new messages