Re: Error with a SQL query 'between .. and .. and'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Turbo Fredriksson <turbo(at)bayour(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Error with a SQL query 'between .. and .. and'
Date: 2002-02-21 15:19:57
Message-ID: 7574.1014304797@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Turbo Fredriksson <turbo(at)bayour(dot)com> writes:
> This SQL query works in 7.1.3, but not in 7.2, how come?
> select count(*) from log where starttime between now()-interval(60*60) and now() and statuscode='2';
> ERROR: parser: parse error at or near "*"

interval(n) is a type name now, as required by SQL92.

Try

"interval"(60*60)
(60*60)::interval
CAST (60*60 AS interval)

Only the last of these is actually standard.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2002-02-21 15:22:31 Re: Trouble with pg_dumpall import with 7.2
Previous Message Tom Lane 2002-02-21 15:15:11 Re: elog() proposal