Re: Is there a better way to do this? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Is there a better way to do this?
Date
Msg-id 20070828214429.GC19715@svana.org
Whole thread Raw
In response to Is there a better way to do this?  (Wei Weng <wweng@kencast.com>)
List 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@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Ben
Date:
Subject: autovacuum not running
Next
From: Alvaro Herrera
Date:
Subject: Re: autovacuum not running