#36045: Add Support for PostgreSQL Infinity and -Infinity in Date/Time Fields
-------------------------------------+-------------------------------------
Reporter: Kavin Bharathi | Owner: (none)
Type: New feature | Status: closed
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: postgres, infinity, | Triage Stage:
datetime | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):
* resolution: => wontfix
* status: new => closed
Old description:
> **Proposed Feature:**
>
> 1. Add support for parsing PostgreSQL's infinity and -infinity values
> into Django models.
> 2. Represent infinity and -infinity using custom Python objects or
> constants (e.g., django.db.utils.Infinity and -Infinity).
> 3. Ensure seamless integration with Django's ORM for querying, inserting,
> and updating fields containing these values.
> 4. Provide a mechanism to serialize and deserialize these values (e.g.,
> JSON serialization).
>
> **Use Cases:**
>
> 1. Handling open-ended event durations.
> 2. Representing date ranges without a start or end boundary.
> 3. Supporting applications that already use these values in their
> PostgreSQL databases.
>
> **Benefits:**
>
> 1. Enables Django developers to work with PostgreSQL databases more
> effectively.
> 2. Expands Django's compatibility with PostgreSQL's advanced features.
>
> **Potential Challenges:**
>
> 1. Ensuring backward compatibility with existing applications.
> 2. Deciding on a Python representation for infinity that integrates well
> with Django's ORM and other Python libraries.
>
> **References:**
>
> [PostgreSQL Documentation on
> Infinity](https://www.postgresql.org/docs/current/datatype-datetime.html
> #DATATYPE-DATETIME-SPECIAL-VALUES)
New description:
**Proposed Feature:**
1. Add support for parsing PostgreSQL's infinity and -infinity values into
Django models.
2. Represent infinity and -infinity using custom Python objects or
constants (e.g., django.db.utils.Infinity and -Infinity).
3. Ensure seamless integration with Django's ORM for querying, inserting,
and updating fields containing these values.
4. Provide a mechanism to serialize and deserialize these values (e.g.,
JSON serialization).
**Use Cases:**
1. Handling open-ended event durations.
2. Representing date ranges without a start or end boundary.
3. Supporting applications that already use these values in their
PostgreSQL databases.
**Benefits:**
1. Enables Django developers to work with PostgreSQL databases more
effectively.
2. Expands Django's compatibility with PostgreSQL's advanced features.
**Potential Challenges:**
1. Ensuring backward compatibility with existing applications.
2. Deciding on a Python representation for infinity that integrates well
with Django's ORM and other Python libraries.
**References:**
[https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-
DATETIME-SPECIAL-VALUES) PostgreSQL Documentation on Infinity]
--
Comment:
Thanks for the proposal, however, I don't think we can accept it without a
consensus on [https://forum.djangoproject.com/c/internals/5 the Django
Forum]. As you note, there are a lot of open questions about how it could
be implemented, so the design proposal would need to be solid. It's also
unclear if it's a good idea to expose a database-specific feature like
this that - as far as I'm aware - only applies to PostgreSQL. If you want
to pursue this, I would try to implement it as a custom field so you can
better understand what changes are required. Then, if you believe the
changes should be incorporated in Django, make your proposal on the forum.
--
Ticket URL: <https://code.djangoproject.com/ticket/36045#comment:2>
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 view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070194191ed2c5-479ed635-34f7-4746-96b1-7d3b3135e1c5-000000%40eu-central-1.amazonses.com.