Re: Timestamp operator error
От | Tom Lane |
---|---|
Тема | Re: Timestamp operator error |
Дата | |
Msg-id | 27580.1014701489@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Timestamp operator error ("Josh Berkus" <josh@agliodbs.com>) |
Ответы |
Re: Timestamp operator error
Re: Timestamp operator error |
Список | pgsql-sql |
"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
В списке pgsql-sql по дате отправления: