Re: Error with a SQL query 'between .. and .. and' - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Error with a SQL query 'between .. and .. and'
Date
Msg-id 7574.1014304797@sss.pgh.pa.us
Whole thread Raw
In response to Error with a SQL query 'between .. and .. and'  (Turbo Fredriksson <turbo@bayour.com>)
List pgsql-hackers
Turbo Fredriksson <turbo@bayour.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)::intervalCAST (60*60 AS interval)

Only the last of these is actually standard.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: elog() proposal
Next
From: Thomas Lockhart
Date:
Subject: Re: Trouble with pg_dumpall import with 7.2