From: Paul Jungwirth <pj@illuminatedcomputing.com>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: Re: range_agg
Date: Mon, 6 May 2019 11:17:46 -0700
Message-ID: <91d7296b-7174-c2bb-8efa-7bfab53a97c4@illuminatedcomputing.com> (raw)
In-Reply-To: <CADkLM=dP8f8T0oDxOsYWDacZO9ydj3o5xgr7aTvhZgQWonm3Bw@mail.gmail.com>
References: <16d71dc8-34cf-5ebd-1ce5-ccd93c0a14f9@illuminatedcomputing.com>
<CADkLM=dP8f8T0oDxOsYWDacZO9ydj3o5xgr7aTvhZgQWonm3Bw@mail.gmail.com>
On 5/4/19 3:11 PM, Corey Huinker wrote:
> One question is how to aggregate ranges that would leave gaps and/or
> overlaps. So in my extension there is a one-param version that forbids
> gaps & overlaps, but I let you permit them by passing extra parameters,
> so the signature is:
>
>
> Perhaps a third way would be to allow and preserve the gaps.
Thanks for the feedback! I think this is what I'm doing already
(returning an array of ranges), but let me know if I'm misunderstanding.
My extension has these signatures:
range_agg(anyrange) returning anyrange
range_agg(anyrange, bool) returning anyarray
range_agg(anyrange, bool, bool) returning anyarray.
The first variant raises an error if there are gaps or overlaps and
always returns a single range, but the other two return an array of ranges.
I was planning to use the same signatures for my patch to pg, unless
someone thinks they should be different. But I'm starting to wonder if
they shouldn't *all* return arrays. I have two concrete use-cases for
these functions and they both require the array-returning versions. Is
it helpful to have a version that always returns a single range? Or
should I make them all consistent?
Thanks,
--
Paul ~{:-)
pj@illuminatedcomputing.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pj@illuminatedcomputing.com, corey.huinker@gmail.com
Subject: Re: range_agg
In-Reply-To: <91d7296b-7174-c2bb-8efa-7bfab53a97c4@illuminatedcomputing.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox