Re: range_agg

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
Subject: Re: range_agg
Date: 2020-03-08 17:28:24
Message-ID: CAKFQuwbc9eHwuU3vmdCWuhCtdVzPvOaivzYk7xi4HsYsrGXgrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 20, 2019 at 10:43 AM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:

> I took the liberty of rebasing this series on top of recent branch
> master.
>

In the tests there is:

+select '{[a,a],[b,b]}'::textmultirange;
+ textmultirange
+----------------
+ {[a,a],[b,b]}
+(1 row)
+
+-- without canonicalization, we can't join these:
+select '{[a,a], [b,b]}'::textmultirange;
+ textmultirange
+----------------
+ {[a,a],[b,b]}
+(1 row)
+

Aside from the comment they are identical so I'm confused as to why both
tests exist - though I suspect it has to do with the fact that the expected
result would be {[a,b]} since text is discrete.

Also, the current patch set seems a bit undecided on whether it wants to be
truly a multi-range or a range that can report non-contiguous components.
Specifically,

+select '{[a,d), [b,f]}'::textmultirange;
+ textmultirange
+----------------
+ {[a,f]}
+(1 row)

There is a an argument that a multi-range should output {[a,d),[b,f]}. IMO
its arguable that a multi-range container should not try and reduce the
number of contained ranges at all. If that is indeed a desire, which seems
like it is, that feature alone goes a long way to support wanting to just
merge the desired functionality into the existing range type, where the
final output has the minimum number of contiguous ranges possible, rather
than having a separate multirange type.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-03-08 17:31:03 pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed at end-of-transaction
Previous Message Tom Lane 2020-03-08 16:56:02 Re: range_agg