Re: Range Types: << >> -|- ops vs empty range

Erik Rijkers <er@xs4all.nl>

From: "Erik Rijkers" <er@xs4all.nl>
To: "Jeff Davis" <pgsql@j-davis.com>
Cc: pgsql-hackers@postgresql.org
Date: 2011-02-11T14:09:02Z
Lists: pgsql-hackers
On Wed, February 9, 2011 09:35, Jeff Davis wrote:
> Updated patch.
>

The operators  <<  >>  and -|-  have the following behavior with empty ranges:

testdb=# select '-'::int4range << range(200,300);
ERROR:  empty range
testdb=# select '-'::int4range >> range(200,300);
ERROR:  empty range
testdb=# select '-'::int4range -|- range(200,300);
ERROR:  empty range

I'm not sure if that is deliberate behavior, but they seem
almost bugs to me.

Wouldn't it be better (and more practical) if these would
return false (or perhaps NULL, for 'unknown') ?

(the same goes for all the other range types, btw.)


Erik Rijkers