Opened 10 years ago

Last modified 10 years ago

#23753 closed New feature

Provide a set of SQL functions — at Initial Version

Reported by: Josh Smeaton Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Release blocker Keywords: expressions
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

When #14030 lands there will be an easy way to implement SQL functions like LENGTH() and COALESCE(). There are several tickets requesting the implementation of certain functions, and this ticket aims to collate those requests, and extend the number of functions to a useable minimum subset. There was a discussion on the mailing list that calls out some implementation details as well as the set of functions to implement: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/django-developers/HggiPzwkono/SgXt4iNjTIYJ

List of functions:

  • Coalesce
  • ToLower/Lower
  • ToUpper/Upper
  • Length
  • Case-When / IIF
  • Substring

This list isn't necessarily complete or final. If there are other functions that you'd like to see implemented in core, please comment, and I'll update the list above. Particular implementation details can be discussed on the PR or below once a PR is submitted. I'll aim to have these completed very soon after #14030 lands, and I expect these to be available in the same django version that incorporates 14030.

Linked tickets:

  • #23363 (Length)
  • #21208 (Coalesce in .extra)
  • #10929 (Coalesce for Aggregates - could also be done by customising the aggregate directly)

Change History (0)

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