Re: range_agg

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: range_agg
Date: 2020-03-07 21:26:58
Message-ID: CAFj8pRBraPOa6NmL39A2frz6idi3XmPbQaVaMXSqvHtZ=h_DWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

so 7. 3. 2020 v 22:20 odesílatel Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> napsal:

> I wrote:
> > Actually ... have you given any thought to just deciding that ranges and
> > multiranges are the same type? That is, any range can now potentially
> > contain multiple segments? That would eliminate a whole lot of the
> > tedious infrastructure hacking involved in this patch, and let you focus
> > on the actually-useful functionality.
>
> Also, this would allow us to remove at least one ugly misfeature:
>
> regression=# select '[1,2]'::int4range + '[3,10)'::int4range;
> ?column?
> ----------
> [1,10)
> (1 row)
>
> regression=# select '[1,2]'::int4range + '[4,10)'::int4range;
> ERROR: result of range union would not be contiguous
>
> If the result of range_union can be a multirange as easily as not,
> we would no longer have to throw an error here.
>

I think this behave is correct. Sometimes you should to get only one range
- and this check is a protection against not continuous range.

if you expect multirange, then do

select '[1,2]'::int4range::multirange + '[4,10)'::int4range;

Regards

Pavel

>
> regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-03-07 21:40:10 Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*)
Previous Message Tom Lane 2020-03-07 21:23:58 Re: Add an optional timeout clause to isolationtester step.