(resending--Martin didn't realize you hadn't sent to the list too.)
(1 row)
On Fri, Jan 13, 2023 at 2:28 PM Martin L. Buchanan <martinlbuchanan@xxxxxxxxx> wrote:
Dear Ken:You can extract individual subfields of interval as described here:
Hi Martin. I don't think that really gets at what's actually being stored. For example, look at a 2-year interval. Tom says they are being represented internally as Months, Days and Microseconds. But if you use extract it does not report anything for these values, because for example months which might be 24 internally is being reported as 0 because years is reported as 2:
SELECT EXTRACT(YEARS FROM '2 years'::interval) AS years, EXTRACT(MONTHS FROM '2 years'::interval) AS months, EXTRACT(DAYS FROM '2 years'::interval) AS days, EXTRACT(MICROSECONDS FROM '2 years'::interval) AS seconds;
SELECT EXTRACT(YEARS FROM '2 years'::interval) AS years, EXTRACT(MONTHS FROM '2 years'::interval) AS months, EXTRACT(DAYS FROM '2 years'::interval) AS days, EXTRACT(MICROSECONDS FROM '2 years'::interval) AS seconds;
years | months | days | seconds
-------+--------+------+---------
2 | 0 | 0 | 0
-------+--------+------+---------
2 | 0 | 0 | 0
(1 row)
--AGENCY SoftwareA Free Software data systemBy and for non-profits(253) 245-3801learn more about AGENCY orfollow the discussion.
AGENCY Software
A Free Software data system
By and for non-profits
(253) 245-3801
learn more about AGENCY or
follow the discussion.