Do we want empty ranges? The philosophy is that they are essentially the "zero" value of any range type. Like the number zero, it allows closure over operations that would otherwise return an error.
For instance, the number zero is useful because you can do things like: f(x) = 5x + 3; And even if x is zero, the function is still defined, and even produces a more "real" number like 3. Sure, when you try to divide by zero, you have a problem, but otherwise it works. Similarly, "intersection" of ranges is somewhat analogous to multiplication of numbers. I have a feeling that there are a lot of applications that might use intersection in combination with other operators, like overlaps or contains. If we do allow empty ranges, I think it will be seamless in most of those situations because "overlaps" and "contains" are well-defined for empty ranges. But if we don't allow empty ranges, I suspect that it will cause some user surprise, because depending on the order of operations an empty range may be created (causing an error) or not. The cost, of course, is that not all operations are well-defined for empty ranges. I think those are mostly operators like those mentioned in the other thread: ">>" (strictly right of), "<<" (strictly left of), and "-|-" (adjacent); and perhaps "&>" and "&<". These are probably used a little less frequently, and should probably not be used in a context where empty ranges are permitted (if they are, it's likely a mistake and an error should be thrown). My feeling is that we should let the operation proceed as far as it is well-defined, and no further; and I think that means empty ranges should be allowed. Thoughts? Do the benefits outweigh the costs? Regards, Jeff Davis -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers