Division of intervals. - Mailing list pgsql-general

From Joshua Moore-Oliva
Subject Division of intervals.
Date
Msg-id 200303181932.48369.josh@chatgris.com
Whole thread Raw
Responses Re: Division of intervals.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Attempting rather unsuccessfully to convert something of the form

45 years 9 mons 5 days 20:28:18.886891

to a total number of months, I attempted

SELECT age(now(), timestamp '1957-06-13') / interval '1 month';

and got the error

ERROR:  Unable to identify an operator '/' for types 'interval' and 'interval'
        You will have to retype this query using an explicit cast


Does anyone know what interval format intervals are stored as?  Is there a way
I can cast this expression to be able to find the number of months within
this interval?

Or is there a function I don't know about capable of doing this? (extracting
the total number of a specific interval from another interval)...  e.g. total
number of months, total number of days...

Josh.

pgsql-general by date:

Previous
From: James Gregory
Date:
Subject: Re: Referential Integrity problem
Next
From: Stephan Szabo
Date:
Subject: Re: Referential Integrity problem