pg_year
YEAR data type
pg_year · YEAR data type
Overview
Usage
Sources:
- Official upstream README
- Official extension control file (pg_year.control)
- Official extension SQL (pg_year–0.0.1.sql)
pg_year — This extension has been validated with PostgreSQL 12, 13, 14, 15, 16, 17 and 18. Use it when application data needs this type, domain, or its operators. Use the pinned upstream revision linked above as the API boundary and test it on the target PostgreSQL build.
Core Workflow
Install the extension in the intended database, run the smallest upstream example above when available, and verify the installed version and returned values before integrating it into application SQL.
Important Objects
hash_year(year)is an extension function and returnsinteger.year_add(year, int)is an extension function and returnsyear.year_cmp(year, year)is an extension function and returnsinteger.year_eq(year, year)is an extension function and returnsboolean.year_ge(year, year)is an extension function and returnsboolean.year_gt(year, year)is an extension function and returnsboolean.year_in(cstring)is an extension function and returnsyear.year_le(year, year)is an extension function and returnsboolean.year_lt(year, year)is an extension function and returnsboolean.year_minus(year, int)is an extension function and returnsyear.year_ne(year, year)is an extension function and returnsboolean.year_out(year)is an extension function and returnscstring.yearis an extension-defined type.btree_year_opsis an extension-defined operator class.
Requirements and Caveats
- The reviewed control file declares default version
0.0.1. - The control file marks the extension as non-relocatable.
- Confirm privileges, supported PostgreSQL versions, upgrade behavior, and failure cases against the pinned source before production use.