diff --git a/lib/Doctrine/Expression/Pgsql.php b/lib/Doctrine/Expression/Pgsql.php index b7eb58a13..0642120d3 100644 --- a/lib/Doctrine/Expression/Pgsql.php +++ b/lib/Doctrine/Expression/Pgsql.php @@ -92,6 +92,34 @@ class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver * @param string|array(string) strings that will be concatinated. * @return string */ + + + /** + * PostgreSQLs AGE( [, ]) function. + * + * @param string $timestamp1 timestamp to subtract from NOW() + * @param string $timestamp2 optional; if given: subtract arguments + * @return string + */ + public function age($timestamp1, $timestamp2 = null) { + if( $timestamp2 == null ) { + return 'AGE(' . $timestamp1 . ')'; + } + return 'AGE(' . $timestamp1 . ', ' . $timestamp2 . ')'; + } + + /** + * PostgreSQLs DATE_PART( ,