X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 101F8474E5C for ; Thu, 13 Feb 2003 04:43:15 -0500 (EST) Received: from localhost.localdomain (B40d7.pppool.de [213.7.64.215]) by postgresql.org (Postfix) with ESMTP id F1827474E42 for ; Thu, 13 Feb 2003 04:43:12 -0500 (EST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.11.6/8.11.6) with ESMTP id h1D9enM01679; Thu, 13 Feb 2003 10:40:49 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Nicholas Allen To: Bruno Wolff III Subject: Re: Possible bug in Postgres? Followup to "How do you select from a table until a condition is met?" Date: Thu, 13 Feb 2003 10:40:49 +0100 User-Agent: KMail/1.4.1 Cc: Dmitry Tkach , pgsql-sql@postgresql.org References: <200302121910.38232.nallen@freenet.co.uk> <200302122321.18463.nallen@freenet.co.uk> <20030213021907.GA2561@wolff.to> In-Reply-To: <20030213021907.GA2561@wolff.to> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200302131040.49257.nallen@freenet.co.uk> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/279 X-Sequence-Number: 11677 But I'm not returning the surnames. I just execute this query (sorry I forg= ot=20 to put it in my last email): select count(*) FROM vu_tbl_user_all_s WHERE s_surname < 'Asurname' or=20 (s_surname =3D 'Asurname' and s_alias <=3D 'CISX' and s_loginid <=3D 'Login= id8')=20 ORDER BY s_surname, s_loginid; So all I am returning is the count right? If I execute the query using *=20 instead of count(*) to actually see the rows it returns the rows as expecte= d=20 upto the row I was interested in. I would assume if postgres can execute a= =20 query to give me row data it should also be able to execute the query and= =20 count the rows without actually giving me the row data when I use count(*).= =20 I have tried this on MySQL and it works just not on Postgres so it doesn't= =20 seem to be something I am doing wrong. Which is why I thought it must be a= =20 bug in Postgres.=20 Am I not missing something here. Is there something wrong with the syntax o= f=20 the above query? Thjanks again for your help! I really appreciate it. On Thursday 13 Feb 2003 3:19 am, Bruno Wolff III wrote: > On Wed, Feb 12, 2003 at 23:21:18 +0100, > > Nicholas Allen wrote: > > However, if I try to count the records using the count(*) function I get > > the following error. > > > > ERROR: Attribute vu_tbl_user_all_s.s_surname must be GROUPed or used in > > an aggregate function > > > > Surely, if postgres can execute the query it should also be able to cou= nt > > the rows that would be returned in the query? Is this a bug in Postgres > > and is there a work around? I am using Postgres 7.3. > > If you are using count you probably don't want to be returning surnames, > just the count. > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html