The following bug has been logged on the website: Bug reference: 6512 Logged by: Stefano Baccianella Email address: stefano.bacciane...@gmail.com PostgreSQL version: 9.1.1 Operating system: Windows 7 64bit Description:
When trying to execute a query like: SELECT * FROM table WHERE timestamp_column > $1 AND timestamp_column < $1 + interval '1 hour' There is no problems, but when executing SELECT * FROM table WHERE timestamp_column > $1 - interval '1 hour' AND timestamp_column < $1 + interval '1 hour' The database return a error saying the the operator timestamp > interval does not exist. Either the query SELECT * FROM table WHERE timestamp_column < $1 + interval '1 hour' AND timestamp_column > $1 Does not work The $1 value is a timestamp (like now() for instance). But the query SELECT * FROM table WHERE timestamp_column = $1 OR ( timestamp_column > $1 - interval '1 hour' AND timestamp_column < $1 + interval '1 hour') works as expected. It seems that the analyzer cannot guess the value of a prepared statement combined with an interval. For my test i'm using PHP without PDO. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs