Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 842AF474E49 for ; Tue, 26 Feb 2002 00:31:27 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g1Q5VUS27583; Tue, 26 Feb 2002 00:31:30 -0500 (EST) To: "Josh Berkus" Cc: pgsql-sql@postgresql.org Subject: Re: Timestamp operator error In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Mon, 25 Feb 2002 21:20:02 -0800" Date: Tue, 26 Feb 2002 00:31:29 -0500 Message-ID: <27580.1014701489@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200202/382 X-Sequence-Number: 6804 "Josh Berkus" 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