Opened 3 days ago

Closed 3 days ago

#36045 closed New feature (wontfix)

Add Support for PostgreSQL Infinity and -Infinity in Date/Time Fields

Reported by: Kavin Bharathi Owned by:
Component: Database layer (models, ORM) Version: 5.1
Severity: Normal Keywords: postgres, infinity, datetime
Cc: Kavin Bharathi Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

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

Change History (2)

comment:1 by Kavin Bharathi, 3 days ago

Keywords: postgres infinity datetime added

comment:2 by Tim Graham, 3 days ago

Description: modified (diff)
Resolution: wontfix
Status: newclosed

Thanks for the proposal, however, I don't think we can accept it without a consensus on 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.

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