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 "*"

If I precalculate 60*60, I get this:

select count(*) from log where starttime between now()-interval(3600) and now() and statuscode='2';
ERROR:  parser: parse error at or near "and"


nuclear supercomputer explosion Marxist FBI Iran SEAL Team 6 quiche
Qaddafi nitrate class struggle South Africa counter-intelligence
attack Ortega
[See http://www.aclu.org/echelonwatch/index.html for more about this]

21 Feb 2002 09:58:53 +0100
Turbo Fredriksson <turbo@bayour.com>
Error with a SQL query 'between .. and .. and'
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)::interval
	CAST (60*60 AS interval)

Only the last of these is actually standard.

			regards, tom lane

Thu, 21 Feb 2002 10:19:57 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Error with a SQL query 'between .. and .. and' 