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

From: "Erik Rijkers" <er(at)xs4all(dot)nl>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: "Kevin Grittner" <kevin(dot)grittner(at)wicourts(dot)gov>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Jeff Davis" <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Range Types: << >> -|- ops vs empty range
Date: 2011-02-11 18:08:43
Message-ID: b7d7f2a98fb03fe941c4344f61a02d88.squirrel@webmail.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, February 11, 2011 19:02, Josh Berkus wrote:
>
>> "empty range"
>> =============
>> Zero length?
>> If so, is it fixed at some point, but empty?
>> '(x,x)'?
>> '[x,x)'?
>
> Neither of the above should be possible, I think. The expression "(x"
> logically excludes the expression "x)".
>
> However, "[x,x]" would be valid, and would be a zero-length interval at
> the point "x".
>
>> Is it everything?
>> '[-inf,+inf]'?
>
> No, that's "everything" which is a different concept. The above also
> ought to be possible, and overlap everything.
>
>> Is it really meaningfully distinct from NULL?
>
> Yes. NULL means "I don't know". If a range type IS NULL, then any
> operation performed with it ought to be NULL. Hence:
>
> IF y > x, THEN:
>
> [x,x] << [y,z) == TRUE
> [x,x] -|- (x,y] == TRUE
> NULL << [y,z} IS NULL
> [-inf,+inf] << [y,z) == FALSE
>
> I can imagine using all of these constructs in actual applications. In
> fact, I have *already* used [-inf,+inf]
>

You say yes, but you don't mention "empty range".

Maybe we can indeed do without the concept of an empty-range?;
it might simplify implementation as well as usage.

I'm not decided, but I do find it hard to find a plausible use-case for it.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-02-11 18:09:08 Re: ALTER EXTENSION UPGRADE, v3
Previous Message Noah Misch 2011-02-11 18:08:08 Re: ALTER TYPE 2: skip already-provable no-work rewrites