Re: 7.0 weirdness

From: Peter Vazsonyi <neko(at)kredit(dot)sth(dot)szif(dot)hu>
To: Jeff MacDonald <jeff(at)pgsql(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: 7.0 weirdness
Date: 2000-05-31 06:45:08
Message-ID: Pine.LNX.4.10.10005310830540.7240-100000@kredit.sth.szif.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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 aggregate
FROM members -- ... etc
GROUP 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;(

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB 2000-05-31 07:28:51 AW: Applying TOAST to CURRENT
Previous Message Tom Lane 2000-05-31 06:20:55 Re: SET FSYNC command?

Browse pgsql-sql by date

  From Date Subject
Next Message Rostislav Opocensky 2000-05-31 10:33:05 Re: Function-based index not used in a simple query
Previous Message Tom Lane 2000-05-31 05:58:37 Re: Re: Pg/PLSQL Errors!!