Let's say you want to get an integer that is the number of months between two dates in psql (payment_date
and creation_date
are dates), and the following command:
select extract(month from (payment_date - creation_date) * interval '1 day') from invoice;
fails with:
ERROR: function pg_catalog.date_part(unknown, integer) does not exist
HINT: No function matches the given name and argument types. You might need to add explicit type casts.