Re: range_adjacent and discrete ranges - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: range_adjacent and discrete ranges
Date
Msg-id 1321635366.11794.47.camel@jdavis
Whole thread Raw
In response to Re: range_adjacent and discrete ranges  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: range_adjacent and discrete ranges
List pgsql-hackers
On Fri, 2011-11-18 at 10:33 -0500, Tom Lane wrote:
> regression=# select int4range(4,4,'(]');
> ERROR:  range lower bound must be less than or equal to range upper bound
> regression=# select int4range(4,4,'()');
> ERROR:  range lower bound must be less than or equal to range upper bound
> 
> Would it be better for them to silently transform such cases to "empty"?

That had crossed my mind, but I read the first as saying that it
includes 4 and doesn't include 4, which is a little confusing.

But I wouldn't object to making them return empty ranges. Seeing that we
removed some other errors in favor of returning something, it might be a
little more consistent to return empty when possible.

I wouldn't like to extend that to int4range(4,3), however. When the
upper bound is less than the lower bound, it's almost certainly a
mistake, and the user should be informed.

By the way, what does this have to do with canonical functions? This
seems more like a constructor issue, and there is already a
zero-argument constructor to make empty ranges.

Regards,Jeff Davis



pgsql-hackers by date:

Previous
From: David Zwarg
Date:
Subject: Re: OidFunctionCall* returning null.
Next
From: Jeff Davis
Date:
Subject: Re: range_adjacent and discrete ranges