Re: Is there a better way to do this?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Wei Weng <wweng(at)kencast(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there a better way to do this?
Date: 2007-08-28 21:44:30
Message-ID: 20070828214429.GC19715@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 28, 2007 at 04:59:46PM -0400, Wei Weng wrote:
> Hi all
>
> I want to implement something like the following:

Well, you could always implement it as SQL instead (untested):

CREATE OR REPLACE FUNCTION AddDays
(TIMESTAMP WITHOUT TIME ZONE
, INT)
RETURNS TIMESTAMP WITHOUT TIME ZONE AS '
SELECT $1+$2*24*3600*''1 second''::INTERVAL;
' LANGUAGE 'sql';

Not sure if it qualifies as 'more concise' though.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-08-28 21:46:36 Re: autovacuum not running
Previous Message Ben 2007-08-28 21:39:50 autovacuum not running