Re: Intervals and ISO 8601 duration

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Intervals and ISO 8601 duration
Date: 2023-01-14 00:28:01
Message-ID: CAD3a31Vk7z_ADWt8qtySB+An8aFTGmYvT5979Da0JGhDoy3yUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jan 13, 2023 at 3:44 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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
*http://agency-software.org/ <http://agency-software.org/>*
*https://demo.agency-software.org/client
<https://demo.agency-software.org/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801

Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2023-01-14 00:57:15 Re: Intervals and ISO 8601 duration
Previous Message Adrian Klaver 2023-01-14 00:08:41 Re: Intervals and ISO 8601 duration