Opened 10 years ago

Closed 10 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 Adam Johnson, 10 years ago

Owner: changed from nobody to Adam Johnson
Status: newassigned

comment:2 by Adam Johnson, 10 years ago

"runtests.py db_functions" passes with MySQL 5.6 locally.

comment:3 by Tim Graham, 10 years ago

Triage Stage: UnreviewedReady for checkin

Looks okay to me (but not a MySQL user). Could someone else +1?

comment:4 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 9d0c600:

Fixed #24609 -- Made ConcatPair use CONCAT_WS() on MySQL

Note: See TracTickets for help on using tickets.
Back to Top