Re: Possible bug in Postgres? Followup to "How do you select - Mailing list pgsql-sql

From Peter Childs
Subject Re: Possible bug in Postgres? Followup to "How do you select
Date
Msg-id Pine.LNX.4.44.0302130952450.6134-100000@RedDragon.Childs
Whole thread Raw
In response to Re: Possible bug in Postgres? Followup to "How do you select from a table until a condition is met?"  (Nicholas Allen <nallen@freenet.co.uk>)
Responses Re: Possible bug in Postgres? Followup to "How do you select  (Nicholas Allen <nallen@freenet.co.uk>)
List pgsql-sql
On Thu, 13 Feb 2003, Nicholas Allen wrote:

> 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;
Excuse me but why are you ordering a SELECT count(*) statement.  
The ORDER BY clause is probably why you it wants to group it because
postgres whats somthing to order.

> 
> 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. 
I can't see the bug its saying order by surname so it looks for
some surnames to order by finds none so complains.  If there is any bug
its likly to be that this works in MySQL. :)

> 
> Am I not missing something here. Is there something wrong with the syntax of 
> the above query?
Sorry but don't try sorting unless you have somthing to sort.
> 
> Thjanks again for your help! I really appreciate it.

Peter Childs



pgsql-sql by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: SQL Functions vs PL/PgSQL
Next
From: Nicholas Allen
Date:
Subject: Re: Possible bug in Postgres? Followup to "How do you select