Re: 7.0 weirdness - Mailing list pgsql-sql

From Peter Vazsonyi
Subject Re: 7.0 weirdness
Date
Msg-id Pine.LNX.4.10.10005310830540.7240-100000@kredit.sth.szif.hu
Whole thread Raw
In response to Re: 7.0 weirdness  (Jeff MacDonald <jeff@pgsql.com>)
List pgsql-sql
Hi Jeff!

I think you need a solution, and not explains...
Tom, and the others told the truth. You missed this query.

> gid is unique.. it's a serial..
I give you two ways:

1) gid __realy__ unique  ->  DISTINCT is unnecessary.SELECT gid FROM members -- ... etc 

2) gid not unique  ->  DISTINCT is not enough. ;(SELECT gid,MAX(created) -- or MIN or AVG ... any aggregateFROM members
--... etcGROUP BY gid ORDER BY 2; -- second colunm
 

> > >gm=> SELECT DISTINCT gid FROM members
> > >gm-> WHERE active = 't'
> > >gm-> AND  (gender = 0
> > >gm->         AND  (wantrstypemale LIKE '%Short Term%'
> > >gm->                 OR wantrstypemale like '%Marriage%'
> > >gm->                 OR wantrstypemale like '%Long Term%'
> > >gm->                 OR wantrstypemale like '%Penpal%'
> > >gm->                 OR wantrstypemale like '%Activity Partner%')
> > >gm-> )  order by created desc;
> > >ERROR:  For SELECT DISTINCT, ORDER BY expressions must appear in target 

best regards
--nek;(



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: Pg/PLSQL Errors!!
Next
From: Rostislav Opocensky
Date:
Subject: Re: Function-based index not used in a simple query