Fwd: range_agg() missing support for multirange inputs
От | Ian R. Campbell |
---|---|
Тема | Fwd: range_agg() missing support for multirange inputs |
Дата | |
Msg-id | CAOC8YUdFVtD-fc7WbPrbqyTVzGse+bhdBXLxPDRUFK-uxczAWA@mail.gmail.com обсуждение исходный текст |
Ответ на | range_agg() missing support for multirange inputs ("Ian R. Campbell" <ian.campbell@thepathcentral.com>) |
Ответы |
Re: range_agg() missing support for multirange inputs
|
Список | pgsql-bugs |
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
В списке pgsql-bugs по дате отправления: