Re: Fixing row comparison semantics

Bruce Momjian <pgman@candle.pha.pa.us>

From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christopher Kings-Lynne <chriskl@familyhealth.com.au>, pgsql-hackers@postgresql.org
Date: 2005-12-26T05:15:12Z
Lists: pgsql-hackers
Tom Lane wrote:
> Christopher Kings-Lynne <chriskl@familyhealth.com.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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073