Re: Fixing row comparison semantics

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fixing row comparison semantics
Date: 2005-12-26 05:15:12
Message-ID: 200512260515.jBQ5FCO09783@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > Can someone explain to me how:
> > (a, b) < (1, 2)
> > is different to
> > a < 1 and b < 2
>
> Right at the moment our code interprets it that way, but this behavior
> is wrong per spec. It should be an ordered column-by-column comparison,
> so that the equivalent simple expression is
>
> (a < 1) OR (a = 1 AND b < 2)

TODO updated:

* %Make row-wise comparisons work per SQL spec

Right now, '(a, b) < (1, 2)' is processed as 'a < 1 and b < 2', but
the SQL standard requires it to be processed as a column-by-column
comparison, so the proper comparison is '(a < 1) OR (a = 1 AND b < 2)'

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-12-26 11:04:26 Re: Incremental Backup Script
Previous Message Bruce Momjian 2005-12-26 05:09:35 Re: Fixing row comparison semantics