#24585: Remove repetitive guarding against double quoting database identifiers
----------------------------------------------+--------------------
     Reporter:  jdufresne                     |      Owner:  nobody
         Type:  Cleanup/optimization          |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  master
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 All built-in database backends define a `quote_name()` function. In all
 cases, the function first checks if the string argument is already quoted.

 IMO, this looks a bit like "just in case" style programming and a bit of a
 code smell. Ideally, the calling code should not be passing quoted names
 in the first place. The Django logic should be such that names are quoted
 exactly once and not multiple time. I believe if names are quoted twice,
 it should be treated as a bug in the calling code, not a bug in the
 `quote_name()` function.

 After testing, these guards are unnecessary and all tests pass without it
 across multiple database backends.

 Removing the guard means it won't need to be checked every time SQL names
 are quoted.

 PR to follow.

--
Ticket URL: <https://code.djangoproject.com/ticket/24585>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.c7f4e953766abc1eb2ad2f9e9b552e9f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to