From: | "Joel Jacobson" <joel(at)compiler(dot)org> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: [PATCH] Support empty ranges with bounds information |
Date: | 2021-03-02 20:00:42 |
Message-ID: | 1ed6d3f7-b1a1-4ee6-bdea-d76961daeace@www.fastmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Mar 2, 2021, at 20:20, Joel Jacobson wrote:
> On Tue, Mar 2, 2021, at 19:16, Chapman Flack wrote:
>> Secretly, in the sense that upper(), lower(), and the default sort
>> operator would keep their established behavior, but new functions like
>> upper_or_pos(), lower_or_pos() would return the non-NULL value even for
>> an empty range, and another sort operator could be provided for use
>> when one wants the ordering to reflect it?
>
> I will work on a new patch to try out this idea.
Here is a patch implementing this idea.
lower() and upper() are now restored to their originals.
The new functions range_start() and range_end()
works just like lower() and upper(),
except they also return bounds information for empty ranges,
if available, otherwise they return null.
This means, there is no risk of affecting any current users of ranges.
I think this a good pragmatical solution to many real-world problems that can be solved efficiently with ranges.
I've also added test coverage of lower() and upper() for null range values.
/Joel
Attachment | Content-Type | Size |
---|---|---|
empty-ranges-with-bounds-information-v2.patch | application/octet-stream | 6.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Jacobson | 2021-03-02 20:04:04 | Re: [PATCH] Support empty ranges with bounds information |
Previous Message | Mark Dilger | 2021-03-02 19:57:53 | Re: [PATCH] Support empty ranges with bounds information |