Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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: Mon, 26 Dec 2005 00:15:12 -0500 (EST)
  • Message-id: <200512260515(dot)jBQ5FCO09783(at)candle(dot)pha(dot)pa(dot)us>

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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group