Questo è facile da re-implementare in PostgreSQL semplicemente usando le funzioni SQL per riordinare ciò che hai già:
create function months_of(interval)
returns int strict immutable language sql as $$
select extract(years from $1)::int * 12 + extract(month from $1)::int
$$;
create function months_between(date, date)
returns int strict immutable language sql as $$
select abs(months_of(age($1, $2)))
$$;
E ora select months_between('1978-06-20', '2011-12-09')
produce 401.