Opened 11 years ago
Closed 11 years ago
#24609 closed Cleanup/optimization (fixed)
Concat on MySQL doesn't need the coalesce step
| Reported by: | Adam Johnson | Owned by: | Adam Johnson |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.8 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The new Concat database function calls ConcatPair which does a coalesce around each argument with the empty string on sqlite and MySQL.
MySQL's CONCAT *does* return NULL if any argument is NULL, however it has a very similar function, CONCAT_WS that just silently skips NULLs. Therefore it can be used rather than unnecessary COALESCE calls: https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_concat-ws
I've implemented this in a patch - it's not a big change.
Change History (4)
comment:1 by , 11 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 11 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
Looks okay to me (but not a MySQL user). Could someone else +1?
https://github.com/django/django/pull/4468