Re: Intervals and ISO 8601 duration - Mailing list pgsql-general

From Ken Tanzer
Subject Re: Intervals and ISO 8601 duration
Date
Msg-id CAD3a31Vk7z_ADWt8qtySB+An8aFTGmYvT5979Da0JGhDoy3yUg@mail.gmail.com
Whole thread Raw
In response to Re: Intervals and ISO 8601 duration  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Intervals and ISO 8601 duration  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Fri, Jan 13, 2023 at 3:44 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
If I am following what you want is to_char(<interval>,'HH24:MM:SS') to
be equal, correct?

Not really.  My original question was:

[since intervals are stored internally as months, days and microseconds...]

> What Postgres actually stores for an interval is three fields:
> months, days, and microseconds. 
 
Is there a way to view/extract this raw data for any given interval?

And again, I don't want to make anything equal, I'm looking for ways to get info about the non-identicalness.

I think we've established these two intervals are equal but not identical:
  • '1 day 2 hours'::interval
  • '26 hours'::interval2
Given that, my questions:
  1. Is the internal representation in months, days and microseconds different for these two intervals?
  2. (If no, what else is it that makes them non-identical?)
  3. Is there a way to access the internal representation?
And thanks to all of you who have responded!

Cheers,
Ken

--
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Intervals and ISO 8601 duration
Next
From: Tom Lane
Date:
Subject: Re: Intervals and ISO 8601 duration