mmddyyyy
pg-mm-dd-yyyy · Educational date type with B-tree, wildcard patterns, and GiST nearest-neighbor search
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101985 | mmddyyyy | pg-mm-dd-yyyy | 0.1.0 | TIME | C |
PostgreSQL · 17
Usage
Sources:
mmddyyyy is a teaching extension that stores a date as ten literal MM/DD/YYYY bytes. It demonstrates C base types, operators, B-tree ordering, and a GiST operator class. Upstream explicitly excludes production use; ordinary application dates should use PostgreSQL’s built-in date type.
Core Workflow
Type and Index Semantics
mmddyyyy validates real Gregorian dates and canonical zero-padded text. Casts convert to and from date. mmddyyyy_month, mmddyyyy_day, and mmddyyyy_year expose components. Ordinary comparisons and the default B-tree order dates chronologically, despite the month-first storage spelling.
mmddyyyy_pattern permits a wildcard for any date component; <@ tests component matching. mmddyyyy_gist_ops supports those patterns and <-> nearest-neighbor search. Its distance prioritizes cyclic month difference, then day, then year; it is not elapsed time in days. Index effectiveness depends on the query shape.
Requirements and Limits
The container and correctness suite target PostgreSQL 17. Install the C extension with superuser privileges; it is relocatable and needs no preload. Supported years are 0001–9999, with no BC, infinite dates, or time zones. Binary send/receive functions and upgrade scripts are absent. No license file was present in the reviewed source; a public repository alone does not establish redistribution rights.