"Mel Jamero" <mel@gmanmi.tv> writes:
> help. does anybody know how, without using date_pli, i can make now() + N
> work in newer versions of postgres?
Sure, make a custom operator.
regression=# select now() + 5;
ERROR: operator does not exist: timestamp with time zone + integer
HINT: No operator matches the given name and argument type(s). You may need to
add explicit typecasts.
regression=# create function tstz_plus_int(timestamp with time zone, int)
regression-# returns date as
regression-# 'select $1::date + $2' language sql;
CREATE FUNCTION
regression=# create operator + (
regression(# procedure = tstz_plus_int,
regression(# leftarg = timestamp with time zone,
regression(# rightarg = int);
CREATE OPERATOR
regression=# select now() + 5;
?column?
------------
2003-08-03
(1 row)
regression=#
regards, tom lane