2đź‘Ť
âś…
Unfortunately, this is “as designed”. Putting together
Regardless of the bounds specified when saving the data, PostgreSQL
always returns a range in a canonical form that includes the lower
bound and excludes the upper bound; that is [).
and
-- includes no points (and will be normalized to 'empty')
SELECT '[4,4)'::int4range;
(from https://www.postgresql.org/docs/9.3/static/rangetypes.html)
You are out of luck. There is, however, a feature request for this, https://code.djangoproject.com/ticket/27147.
Fwiw, psycopg2 supports all range bounds types.
Options?
- One off custom sql (yuck)
- Implement the Django feature request and submit a PR
- Just use 2 int columns (fastest)
👤rm -rf
Source:stackexchange.com