Re: so, does this overlap or not...? - fencepost question on overlaps()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: so, does this overlap or not...? - fencepost question on overlaps()
Date: 2010-06-03 14:28:03
Message-ID: 24445.1275575283@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl> writes:
> This doesn't seem to make sense to me, can someone explain the rationale
> behind it?

The rationale is "do what the SQL spec says" ;-)

What the spec says is

( S1 > S2 AND NOT ( S1 >= T2 AND T1 >= T2 ) )
OR
( S2 > S1 AND NOT ( S2 >= T1 AND T2 >= T1 ) )
OR
( S1 = S2 AND ( T1 <> T2 OR T1 = T2 ) )

I seem to recall a previous discussion in the PG lists where we
reverse-engineered a plausible explanation of what the standards
committee had in mind when they wrote this, but I don't have time
right now to go looking for it.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2010-06-03 14:34:48 Re: Auto-partitioning in COPY
Previous Message Tom Lane 2010-06-03 14:00:23 Re: Lock issues with partitioned table