Différence postgresql entre deux dates en jours
SELECT
AGE('2012-03-05', '2010-04-01'),
DATE_PART('year', AGE('2012-03-05', '2010-04-01')) AS years,
DATE_PART('month', AGE('2012-03-05', '2010-04-01')) AS months,
DATE_PART('day', AGE('2012-03-05', '2010-04-01')) AS days;
...
-- This will give you full years, month, days ... between two dates:
-- age | years | months | days
-- -----------------------+-------+--------+------
-- 1 year 11 mons 4 days | 1 | 11 | 4
GutoTrosla