#25487: Add support for months and years in INTERVAL field of PostgreSQL
------------------------------------+--------------------------------------
Reporter: liminspace | Owner: liminspace
Type: New feature | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: postgres, interval | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Comment (by mjtamlyn):
Support for non-fixed durations is complicated - As liminspace mentioned
Python's timedelta does not support months or years (see
https://docs.python.org/3.2/library/datetime.html#datetime.timedelta).
Oracle actually has two completely separate fields for them, and the other
databases we could not store it in a single column either.
Also, what is the form field representation? How do we anticipate a user
will specify "2 months, 4 days and 1 hour" (in every language?), and will
they understand that 30 days != 1 month? In fact in postgres depending on
which functions you use to calculate age, you either get calendar months
or 30 day "months".
I think this should be possible as an external field for postgres and/or
Oracle, as it has external python dependencies as well it should live as
an external package. I'm not sure what psycopg2 does for month/year based
durations as normally it will try to cast `interval` to a `timedelta`.
--
Ticket URL: <https://code.djangoproject.com/ticket/25487#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.de149a9b7a6db3d543b94d2986c1b75f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.