range_agg() missing support for multirange inputs
Consider the following code:
with a(x) as(
values
('{[10,20],[100,200]}'::int4multirange)
,('{[20,40],[15,55],[100,200]}'::int4multirange)
)
select range_agg(x)
from (
select unnest(x)x
from a
)t;
=> {[10,56),[100,201)}
Here, range_agg() won’t accept a multirange type input, but it outputs a
multirange type.
The only way to aggregate the source multirange rows is to unnest them
first.
However, range_intersect_agg() does not require the unnest step:
with a(x) as(
values
('{[10,20],[100,200]}'::int4multirange)
,('{[20,40],[15,55],[100,200]}'::int4multirange)
)
select range_intersect_agg(x)
from a;
=> {[15,21),[100,201)}
Ian Campbell
*Moderator:* I have submitted this bug report twice, but it has never made
it onto the forum and I've never had feedback on it.
All my other reports have been rapidly responded to.
Please advise.
---------- Forwarded message ---------
From: Ian R. Campbell <ian.campbell@thepathcentral.com>
Date: Thu, 25 Nov 2021 at 00:13
Subject: range_agg() missing support for multirange inputs
To: <pgsql-bugs@lists.postgresql.org>
Consider the following code:
with a(x) as(
values
('{[10,20],[100,200]}'::int4multirange)
,('{[20,40],[15,55],[100,200]}'::int4multirange)
)
select range_agg(x)
from (
select unnest(x)x
from a
)t;
=> {[10,56),[100,201)}
Here, range_agg() won’t accept a multirange type input, but it outputs a
multirange type.
The only way to aggregate the source multirange rows is to unnest them
first.
However, range_intersect_agg() does not require the unnest step:
with a(x) as(
values
('{[10,20],[100,200]}'::int4multirange)
,('{[20,40],[15,55],[100,200]}'::int4multirange)
)
select range_intersect_agg(x)
from a;
=> {[15,21),[100,201)}
Ian Campbell
On Tue, Dec 7, 2021 at 6:32 AM Ian R. Campbell <
ian.campbell@thepathcentral.com> wrote:
*Moderator:* I have submitted this bug report twice, but it has never
made it onto the forum and I've never had feedback on it.
I'm not a moderator but I can say that both your posts made it to the
mailing list (or at least its archive...):
/messages/by-id/JNZP275MB0737BDCCB3792619F1DF04128A8C9@JNZP275MB0737.ZAFP275.PROD.OUTLOOK.COM
/messages/by-id/CAOC8YUcOtAGscPa31ik8UEMzgn8uAWA09s6CYOGPyP9_cBbWTw@mail.gmail.com
The lack of feedback is unfortunate but it does happen since replies are up
to individuals to decide to make.
Going from memory at the moment, but I seem to recall this indeed being a
missing behavior for this feature that wasn't caught before feature
freeze. It is likely to be fixed for v15 but for v14 it is a missing
feature. A search of the archives will turn up additional discussion on
this should you wish a more detailed understanding.
David J.
Thanks for the feedback, David.
It’s interesting how some reports are replied to within minutes, though.
Not much time for voting.
On Tue, 07 Dec 2021 at 15:47, David G. Johnston <david.g.johnston@gmail.com>
wrote:
Show quoted text
On Tue, Dec 7, 2021 at 6:32 AM Ian R. Campbell <
ian.campbell@thepathcentral.com> wrote:*Moderator:* I have submitted this bug report twice, but it has never
made it onto the forum and I've never had feedback on it.I'm not a moderator but I can say that both your posts made it to the
mailing list (or at least its archive...):/messages/by-id/JNZP275MB0737BDCCB3792619F1DF04128A8C9@JNZP275MB0737.ZAFP275.PROD.OUTLOOK.COM
/messages/by-id/CAOC8YUcOtAGscPa31ik8UEMzgn8uAWA09s6CYOGPyP9_cBbWTw@mail.gmail.com
The lack of feedback is unfortunate but it does happen since replies are
up to individuals to decide to make.Going from memory at the moment, but I seem to recall this indeed being a
missing behavior for this feature that wasn't caught before feature
freeze. It is likely to be fixed for v15 but for v14 it is a missing
feature. A search of the archives will turn up additional discussion on
this should you wish a more detailed understanding.David J.