On 7/23/2014 12:13 PM, CG wrote:
The parenthesis don't work, but if I explicitly cast that second parameter to interval "CAST( $2 AS interval)" I can force it to work. That's not ideal.
I don't think it is the lack of an operator. Timestamptz should not be comparable directly to an interval, right? That's like saying "2 + 2 >= Orange" or "today is greater than a minute". I think something is eating that first "now() -" so that what is being prepared looks like "trans_date between $2 and now()".
The question is what is causing valid SQL, prepared properly on 32bit linux to fail to prepare properly on 64bit linux? Based on that log, it looks like client-side prepare is falling down.
I think I'd try some experiments with select pg_typeof($1), passing it your 'interval' value and see what it thinks it is.
test=# select pg_typeof(interval '1 day');
pg_typeof
-----------
interval
(1 row)
test=# select pg_typeof('1 day');
pg_typeof
-----------
unknown
(1 row)
--
john r pierce 37N 122W
somewhere on the middle of the left coast