Re: BRIN minmax multi - incorrect distance for infinite timestamp/date

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BRIN minmax multi - incorrect distance for infinite timestamp/date
Date: 2023-10-19 09:22:42
Message-ID: CAExHW5vaO71q9JMY5Lkm-qHht1=y4PzH0rQBKR0hiAmU62w+PA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 19, 2023 at 2:31 PM Tomas Vondra
<tomas(dot)vondra(at)enterprisedb(dot)com> wrote:

>
> Does that explain the algorithm? I'm not against clarifying the comment,
> of course.

Thanks a lot for this explanation. It's clear now.

> I tried to do that, but I ran into troubles with the "date" tests. I
> needed to build values that close to the min/max values, so I did
> something like
>
> SELECT '4713-01-01 BC'::date + (i || ' days')::interval FROM
> generate_series(1,10) s(i);
>
> And then the same for the max date, but that fails because of the
> date/timestamp conversion in date plus operator.
>
> However, maybe two simple generate_series() would work ...
>

Something like this? select i::date from generate_series('4713-02-01
BC'::date, '4713-01-01 BC'::date, '-1 day'::interval) i;
i
---------------
4713-02-01 BC
4713-01-31 BC
4713-01-30 BC
4713-01-29 BC
4713-01-28 BC
4713-01-27 BC
4713-01-26 BC
4713-01-25 BC
4713-01-24 BC
4713-01-23 BC
4713-01-22 BC
4713-01-21 BC
4713-01-20 BC
4713-01-19 BC
4713-01-18 BC
4713-01-17 BC
4713-01-16 BC
4713-01-15 BC
4713-01-14 BC
4713-01-13 BC
4713-01-12 BC
4713-01-11 BC
4713-01-10 BC
4713-01-09 BC
4713-01-08 BC
4713-01-07 BC
4713-01-06 BC
4713-01-05 BC
4713-01-04 BC
4713-01-03 BC
4713-01-02 BC
4713-01-01 BC
(32 rows)

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2023-10-19 09:24:04 RE: [PoC] pg_upgrade: allow to upgrade publisher node
Previous Message Tomas Vondra 2023-10-19 09:05:45 Re: BRIN minmax multi - incorrect distance for infinite timestamp/date