I have a query like this: (on Postgresql 8.4, PHP-fpm 5.3.10 (fpm-fcgi))
select * from users where now() - interval \'2 minutes\' < seenlast ORDER BY seen
I have been struggling with Phalcon and its inner Models PDO parser for hours with the same problem.
I found this solution:
public static function getTimedoutRequests($secsThreshold) {
return self::find(
array(
// PDO is buggy here, can't use INTERVAL
"DATE_PART('epoch', create_time) < DATE_PART('epoch', NOW()) - ?0",
"bind" => array(
$secsThreshold
)
)
);
}