Search Postgresql Archives

Re: Time stamp issue

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

 



On Tue, Jan 08, 2008 at 08:21:40PM +0530, kapil.munish@xxxxxxxxx wrote:
> The query is something like :
> 
> DELETE from CONCURRENT_USER WHERE (now() - CONCURRENT_USER.TIME_STAMP) >
> ?
> 
> Here the calculated value in '?' is not supported by the postgres as it
> was set as a double.

In postgres subtracting two timestamps produces an interval. If you
want to pass your parameter in seconds, try:

DELETE from CONCURRENT_USER WHERE (now() - CONCURRENT_USER.TIME_STAMP) > (? * '1 second'::interval)

Or if the use of indexes is important to you:

DELETE from CONCURRENT_USER WHERE CONCURRENT_USER.TIME_STAMP < (now() - (? * '1 second'::interval));

Perhaps JDBC can handle intervals itself also, that I don't know.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

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