David,
> Has anyone developed PostgreSQL versions of the Oracle date functions? I'm
> especially interested in ports of ADD_MONTHS and NEXT_DAY, or hints on
> replicating them in PostgreSQL.
Trivial:
CREATE FUNCTION add_months (timestamp, integer)
RETURNS timestamp AS '
SELECT $1 + (''1 month''::INTERVAL * $2);
' LANGUAGE SQL IMMUTABLE, STRICT;
CREATE FUNCTION NEXT_DAY (timestamp)
RETURNS timestamp AS '
SELCET $1 + ''1 day''::INTERVAL;
' LANGUAGE SQL IMMUTABLE, STRICT;
--
Josh Berkus
Aglio Database Solutions
San Francisco