Re: sql row constructor...works!

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Michael Glaesemann <grzm(at)myrealbox(dot)com>, Christopher Browne <cbbrowne(at)acm(dot)org>, postgres hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: sql row constructor...works!
Date: 2006-02-08 09:38:59
Message-ID: 1139391538.24321.326.camel@coppola.muc.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Well, I've tested it a bit:

db=# select version();
version
--------------------------------------------------------------------------------------------
PostgreSQL 8.1.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5
(Debian 1:3.3.5-13)
(1 row)

db=# select (1,3) > (2,3);
?column?
----------
f
(1 row)

db=# select (3,3) > (2,3);
?column?
----------
f
(1 row)

db=# select (3,4) > (2,3);
?column?
----------
t
(1 row)

It seems to me that (x,y) > (a,b) means (x > a AND y > b) ... which is
not exactly what you wanted... or I'm missing something ?

Cheers,
Csaba.

On Wed, 2006-02-08 at 03:35, Merlin Moncure wrote:
> > On Feb 8, 2006, at 11:17 , Merlin Moncure wrote:
> >
> > > The proper SQL construct without row constructor is:
> > >
> > > select * from t where
> > > a >= a1 and
> > > (a > a1 or b>= b1) and
> > > (a > a1 or b > b1 or c > c1)
> > > order by a,b,c limit 1 ^ no offset necessary
> > >
> > > confused yet?
> >
> > This is interesting! Could you also provide the equivalent *with* a
> > row constructor? (or did I miss that somewhere?)
>
> select * from t where (a,b,c) > (a1, b1, c1) order by a,b,c limit 1;
> [plus full usage of key on t(a,b,c)]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-02-08 09:59:37 Re: sql row constructor...works!
Previous Message David Fetter 2006-02-08 08:41:06 Re: Audio interview