From: Nicholas Allen <nallen@freenet.co.uk>
To: Bruno Wolff III <bruno@wolff.to>
Cc: Dmitry Tkach <dmitry@openratings.com>
Cc: pgsql-sql@postgresql.org
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
Message-ID: <200302131040.49257.nallen@freenet.co.uk> (raw)
In-Reply-To: <20030213021907.GA2561@wolff.to>
References: <200302121910.38232.nallen@freenet.co.uk>
<200302122321.18463.nallen@freenet.co.uk>
<20030213021907.GA2561@wolff.to>
But I'm not returning the surnames. I just execute this query (sorry I forgot
to put it in my last email):
select count(*) FROM vu_tbl_user_all_s WHERE s_surname < 'Asurname' or
(s_surname = 'Asurname' and s_alias <= 'CISX' and s_loginid <= 'Loginid8')
ORDER BY s_surname, s_loginid;
So all I am returning is the count right? If I execute the query using *
instead of count(*) to actually see the rows it returns the rows as expected
upto the row I was interested in. I would assume if postgres can execute a
query to give me row data it should also be able to execute the query and
count the rows without actually giving me the row data when I use count(*).
I have tried this on MySQL and it works just not on Postgres so it doesn't
seem to be something I am doing wrong. Which is why I thought it must be a
bug in Postgres.
Am I not missing something here. Is there something wrong with the syntax of
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 <nallen@freenet.co.uk> 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 count
> > 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: nallen@freenet.co.uk, bruno@wolff.to, dmitry@openratings.com
Subject: Re: Possible bug in Postgres? Followup to "How do you select from a table until a condition is met?"
In-Reply-To: <200302131040.49257.nallen@freenet.co.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox