django/django — pull request #3754 by jarshwah (2014-12-18 09:48:28+00:00)
Title: [WIP] Fixed #23753 -- Added a suite of SQL Functions

This is a work in progress, but not too far off being code complete. I thought it was better to open a PR rather than have people try to track individual commits on my fork.

A few notes at this point in time:

- I plan on renaming Concat to ConcatPair (name TBD), and renaming ConcatMany to Concat.
- Some backends allow an arbitrary number of args to Concat, but I've chosen implementation simplicity by implementing multi-concat the same across all backends. If performance differences can be shown, I'll revisit this choice.
- Some functions validate args in init, others in resolve expression. I think I'll standardise on init, since objects should be fairly complete on instantiation.
- I won't be implementing Case/When just yet. Michal on the ML has a better implementation than the one I had prototyped, and I'll let Michal finish and submit a PR for that part.
- Tests are basic and should probably cover a lot more failure states.
- Docs. They'll come last as always.

Are we happy about the namespacing? Is `models.functions.*` an OK place?