Re: @ versus ~, redux

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: Re: @ versus ~, redux
Date: 2006-09-04 05:41:41
Message-ID: 02346010-4BAF-41E1-92E8-1F3442FB57B1@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Sep 4, 2006, at 12:44 , Tom Lane wrote:

> OK, so if everyone is leaning to #3, the name game remains to be
> played.
> Do we all agree on this:
>
> "x @> y" means "x contains y"
> "x @< y" means "x is contained in y"
>
> Are we all prepared to sign a solemn oath to commit hara-kiri if we
> invent a new datatype that gets this wrong? No? Maybe these still
> aren't obvious enough.

When I've been working on range/interval stuff, I tried to come up
with a self-consistent set of operator symbols for the Allen
operators, which includes the "contains" and "is contained in" pair.
Here's what I came up with.

Where r1 and r2 are ranges

r1 >> r2 r1 is strictly during r2, i.e., r1 is a strict subset of r2
r1 << r2 r2 is strictly during r1, i.e., r2 is a strict subset of r1
<< and >> are meant to evoke the (strict) subset (⊂ or &sub;) and
superset (⊃ or &sup;) operators.

r1 <<= r2 r1 is a superset of r2
r1 =>> r2 r1 is a subset of r2

<<= and =>> are mean to evoke the subset (⊆ or &sube;) and superset
(⊇ or &supe;) operators.

Assuming the meaning of contains and is contained in is inclusive
(rather than strict), then we'd have

a <<= b : a contains b
a =>> b : a is contained by b

I've included the other Allen operators at the bottom for completeness.

Michael Glaesemann
grzm seespotcode net

r1 = r2 r1 equals r2
r1 <> r2 r1 does not equal r2
For the following, the < or > indicates the relative position of the
two ranges if they were depicted on an line that increases from left
to right.

r1 <| r2 r1 strictly meets r2, i.e., begin(r2) is next(end(r1))
r1 |> r2 r2 strictly meets r2, i.e., begin(r1) is next(end(r2))
The | is meant to evoke the meeting point of r1 and r2. They don't
overlap, they are just abutting. The < or > "points" to the direction
the of the range it points to relative to the other range, i.e., r1
is to the left of r2 on an line that increases from left to right.

r1 </ r2 r1 is before r2
r1 /> r2 r1 is after r2
The / is meant to evoke the fact that they are not abutting.

r1 <& r2 r1 strictly overlaps r2
r1 &> r2 r2 strictly overlaps r1
The & is meant to evoke "and", in that there is something the two
ranges share.

r1 @< r2 r1 starts r2
r1 @> r2 r2 starts r1
r1 >@ r2 r1 finishes r2
r1 <@ r2 r2 finishes r1
The @ is meant to indicate the point where the two ranges share a
begin or end point. E.g., for r1 @< r2, r1 and r2 start together, and
end(r1) < end(r2). For r1 <@ r2, begin(r1) < begin(r2), but they
share the same end point.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-09-04 06:11:23 Re: [HACKERS] Developer's Wiki
Previous Message Lukas Kahwe Smith 2006-09-04 05:40:05 Re: Getting a move on for 8.2 beta