Re: Infinite Interval

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Joseph Koshakow <koshy44(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Infinite Interval
Date: 2023-01-05 10:20:42
Message-ID: CACJufxHB_Otz1ctakPpvbLQ05_8i9_tDA_2e=034Kn8pmFsGUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 4, 2023 at 10:13 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:

>
>
> On Tue, Jan 3, 2023 at 6:14 AM Joseph Koshakow <koshy44(at)gmail(dot)com> wrote:
>
>> I have another patch, this one adds validations to operations that
>> return intervals and updated error messages. I tried to give all of the
>> error messages meaningful text, but I'm starting to think that almost all
>> of them should just say "interval out of range". The current approach
>> may reveal some implementation details and lead to confusion. For
>> example, some subtractions are converted to additions which would lead
>> to an error message about addition.
>>
>> SELECT date 'infinity' - interval 'infinity';
>> ERROR: cannot add infinite values with opposite signs
>>
>> I've also updated the commit message to include the remaining TODOs,
>> which I've copied below
>>
>> 1. Various TODOs in code.
>> 2. Correctly implement interval_part for infinite intervals.
>> 3. Test consolidation.
>> 4. Should we just use the months field to test for infinity?
>>
>
>
> 3. Test consolidation.
> I used the DO command, reduced a lot of test sql code.
> I don't know how to generate an interval.out file.
> I hope the format is ok. I use https://sqlformat.darold.net/ format the
> sql code.
> Then I saw on the internet that one line should be no more than 80 chars.
> so I slightly changed the format.
>
> --
> I recommend David Deutsch's <<The Beginning of Infinity>>
>
> Jian
>
>
>

1. Various TODOs in code.
logic combine and clean up for functions in backend/utils/adt/timestamp.c
(timestamp_pl_interval,timestamptz_pl_interval, interval_pl, interval_mi).
3. Test consolidation in /regress/sql/interval.sql

For 1. I don't know how to format the code. I have a problem installing
pg_indent. If the format is wrong, please reformat.
3. As the previous email thread.

Attachment Content-Type Size
v8_0002_Support_infinite_interval.patch text/x-patch 16.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shruthi Gowda 2023-01-05 10:36:19 Issue in MERGE with concurrent UPDATE and MERGE
Previous Message Alexander Korotkov 2023-01-05 10:14:28 Re: Allow placeholders in ALTER ROLE w/o superuser