Skip to content

Support additional date, time, and interval arithmetic #64

Description

@alexeichhorn

Context

dbkit currently supports timestamp/timestamptz + and - interval expressions. PostgreSQL exposes additional date, time, and interval arithmetic that dbkit rejects at compile time.

Candidate matrix

  • INTERVAL ± INTERVAL → INTERVAL
  • INTERVAL * DOUBLE PRECISION and the commutative multiplication form → INTERVAL
  • INTERVAL / DOUBLE PRECISION → INTERVAL
  • TIMESTAMP - TIMESTAMP → INTERVAL
  • TIMESTAMPTZ - TIMESTAMPTZ → INTERVAL
  • DATE ± INTEGER → DATE
  • DATE ± INTERVAL → TIMESTAMP
  • DATE - DATE → INTEGER
  • DATE + TIME → TIMESTAMP
  • TIME ± INTERVAL → TIME
  • TIME - TIME → INTERVAL

Requirements

  • Implement only PostgreSQL-defined operand directions and result types.
  • Propagate nullable operands to Option<Output>.
  • Add compile-fail coverage for invalid temporal pairs.
  • Test calendar boundaries, negative intervals, and NULL operands where relevant.
  • Keep implicit cross-type temporal comparisons and session-timezone-dependent comparison behavior out of scope.

PostgreSQL date/time operators

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions