Re: BUG #5592: list of integer undefined behaviors

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: John Regehr <regehr(at)cs(dot)utah(dot)edu>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5592: list of integer undefined behaviors
Date: 2010-08-03 10:10:09
Message-ID: AANLkTik8-JpeROLa4Paz=SpDoTCttm-yzJRgOXGn=tgS@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Aug 3, 2010 at 3:33 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Although this is the worst case, you could easily get overflows from
> intervals with ordinary endpoints that are sufficiently far apart.

Oh, duh, this is pretty obvious in retrospect.

> Since this is a nearly-dead legacy datatype, I can't get excited about
> spending a lot of time on it.  What I suggest we do is do the difference
> calculation in int64 arithmetic instead of int32.

At some level this is all not really a problem. It just means that the
arbitrary ordering of tintervals isn't the obvious ordering. If we
change it it would invalidate any indexes on tintervals so it can't be
backpatched. I'm not sure whether it makes sense to bother having a
slightly more sensible ordering in 9.0+ if it's still going to be
wacky in older versions.

Also, does it cause any problem that this comparison function will
treat large swathes of tintervals as equal? Any tinterval with the
same length will compare equal according to this. I suppose it doesn't
have the same problem as strings as long as = is defined compatibly.

--
greg

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-08-03 14:13:42 Re: BUG #5592: list of integer undefined behaviors
Previous Message Fathi 2010-08-03 07:53:37 BUG #5594: Nested views working on same set of data on 8.1.21 but not on 8.4.4