Opened 6 years ago
Last modified 5 years ago
#29916 closed New feature
Add additional Postgres lookups to gain parity with supported range functions in Postgres — at Version 3
Reported by: | Peter J. Farrell | Owned by: | Peter J. Farrell |
---|---|---|---|
Component: | contrib.postgres | Version: | dev |
Severity: | Normal | Keywords: | lower_inf, upper_inf, lower_inc, upper_inc |
Cc: | Sergey Fedoseev, Srinivas Reddy Thatiparthy | 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 (last modified by )
Add support for following functions for Postgres range fields that are currently not supported in Django:
- isempty
- lower_inc
- upper_inc
- lower_inf
- upper_inf
https://www.postgresql.org/docs/9.3/static/functions-range.html
Example usage:
MyObject.objects.filter(date_range__upper_inf=True) # for infinity MyObject.objects.filter(date_range__upper_inf=False) # for not infinity
Example code: https://gist.github.com/peterfarrell/5c7b8d80319563813caba6320b568829
These can all be implemented as new ORM lookups for the Postgres range type fields so the Django ORM can gain parity with functionality available in Postgres range fields.
Change History (3)
comment:1 by , 6 years ago
Owner: | set to |
---|
comment:2 by , 6 years ago
Description: | modified (diff) |
---|
comment:3 by , 6 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
I am volunteering to make a PR to add support for these 5 functions. I will start work on a PR (including tests and documentation) if this ticket is accepted.
I have two working custom lookups (lower_inf and upper_inf) already built (see the gist linked in the main ticket). They need to add casting for different range types to improve compatibility however the concept is sound.