Re: change in now() and ago with 7.x

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: David Stokes <dave(at)greatgeek(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: change in now() and ago with 7.x
Date: 2000-07-06 13:31:09
Message-ID: 39648A1D.7B91864A@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Pre-7.x, we used to use a line like: " request.date_submitted > (now()
> + '24 hours ago')"
> to pull data created in the past day (used against a timestamp).
> Something changed with 7.x that blows that line out.

You will have to be more specific on what is not working for you. afaict
that line should still work:

lockhart=# select * from t1 where d < now() + '24 hours ago';
i | d
---+---------------------------------
1 | Mon Jul 03 00:00:60.00 2000 PDT
...

(though my personal preference is for something like (timestamp 'now' -
interval '24 hours') ).

One thing that changed for 7.0 is that "timestamp" is the primary
date/time type. Make sure that you do everything using that type, rather
than using "datetime"; the latter is sort-of supported by the parser to
help with upgrades, but that support is not complete.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Lockhart 2000-07-06 13:34:11 Re: [HACKERS] pl/pgsql function out parameters
Previous Message Karel Zak 2000-07-06 13:21:53 RE: Find all the dates in the calendar week?