Re: [GENERAL] Doing INTERVAL with NOW() versus casted timestamp

2013-02-16 Thread Tom Lane
John Shott writes: > I believe that if you use the current_date function, instead of now(), > and subtract 24 hours from that, then you will get the behavior that you > expect. If you're working with dates, rather than timestamps, it's even easier than that: just add or subtract an integer. re

Re: [GENERAL] Doing INTERVAL with NOW() versus casted timestamp

2013-02-16 Thread John Shott
Wells: The now() function returns not only the current date, but the current time. So, now() - 24 hours returns yesterday at this time. But, yesterday at 00:00:00 is not greater than or equal to yesterday at the current time (unless, of course, you happened to run this at precisely 00:00:00

Re: [GENERAL] Doing INTERVAL with NOW() versus casted timestamp

2013-02-16 Thread Andreas Kretschmer
Wells Oliver wrote: > Why does this give me two different results? 'created' is a date field: > > SELECT * FROM foo WHERE created >= '2013-02-16 00:00:00'::timestamp - INTERVAL > '24 hours' test=# select '2013-02-16 00:00:00'::timestamp - INTERVAL '24 hours'; ?column?