Re: Intervals and ISO 8601 duration

Поиск
Список
Период
Сортировка
От Ken Tanzer
Тема Re: Intervals and ISO 8601 duration
Дата
Msg-id CAD3a31UP79wrZZTRFtP4sPvgOy7TZg2v6FmPzXYdAAnaOdnuiQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Intervals and ISO 8601 duration  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Intervals and ISO 8601 duration  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Intervals and ISO 8601 duration  (Bryn Llewellyn <bryn@yugabyte.com>)
Список pgsql-general
On Fri, Jan 13, 2023 at 2:41 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
 
> (I'm asking because of an issue that came up about intervals that were
> "equal but not identical.")

1) Can you provide an example?


Here's an example.  Note that they come out formatted differently with to_char, but evaluate as equal.  The explanation(1) was that they were Equal but not Identical.  I was thinking getting the raw data about how they are stored would get at the identicality issue:

WITH inters AS (
SELECT
'1 day 2 hours'::interval AS i1,
'26 hours'::interval AS i2
)
SELECT
*,
to_char(i1,'HH24:MM:SS') AS i1_char,
to_char(i2,'HH24:MM:SS') AS i2_char,
i1=i2 AS "Equal?"
FROM inters;

i1 | i2 | i1_char | i2_char | Equal?
----------------+----------+----------+----------+--------
1 day 02:00:00 | 26:00:00 | 02:00:00 | 26:00:00 | t






Cheers,
Ken


 

>
> Cheers,
> Ken
>
>

--
Adrian Klaver
adrian.klaver@aklaver.com



--
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 по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Intervals and ISO 8601 duration
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Intervals and ISO 8601 duration