"Josh Berkus" <josh@agliodbs.com> writes:
> FMI, though, how difficult is defining an operator if I paid a C
> programmer to do it?
Pretty trivial when it's only the commutation of an existing operator...
Actually you don't even need any C code. You could limp along at some
sacrifice of performance with an SQL function definition. Say
regression=# create function interval_plus_timestamp(interval,timestamp)
regression-# returns timestamp as '
regression'# select $2 + $1;
regression'# ' language 'sql';
CREATE
regression=# create operator + (procedure = interval_plus_timestamp,
regression(# leftarg = interval,
regression(# rightarg = timestamp);
CREATE
et voila:
regression=# select ('6 days'::INTERVAL + current_timestamp); ?column?
-------------------------------2002-03-04 00:28:30.230026-05
(1 row)
I'd not want to make an index depend on this operator, but for
occasional query use it should do fine ...
regards, tom lane