Search Postgresql Archives

Re: Is there a better way to do this?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux