Re: [SQL] pg, mysql comparison with group by clause

2005-10-20 Thread Chris Travers
Greg Stark wrote: Anthony Molinaro [EMAIL PROTECTED] writes: Greg, You'll have to pardon me... I saw this comment: I don't see why you think people stumble on this by accident. I think it's actually an extremely common need. Which, if referring to the ability to have items in the

Re: [SQL] pg, mysql comparison with group by clause

2005-10-14 Thread Greg Stark
Anthony Molinaro [EMAIL PROTECTED] writes: More awkward? What *you're* suggesting is more awkward. You realize that right? How can syntax that is understood and accepted for years be more awkward? Well gosh, I would say that that's something only a newbie could say about SQL of all things...

Re: [SQL] pg, mysql comparison with group by clause

2005-10-14 Thread Anthony Molinaro
Schumeyer; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause Anthony Molinaro [EMAIL PROTECTED] writes: More awkward? What *you're* suggesting is more awkward. You realize that right? How can syntax that is understood and accepted for years be more awkward

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Andrew Sullivan
On Thu, Oct 13, 2005 at 12:24:55AM -0400, Greg Stark wrote: Well the constants and the like are precisely the point. There are plenty of cases where adding the column to the GROUP BY is unnecessary and since Postgres makes no attempt to prune them out, inefficient. But inefficient pruning is

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Scott Marlowe
On Wed, 2005-10-12 at 20:13, Greg Stark wrote: Scott Marlowe [EMAIL PROTECTED] writes: Hehe. When I turn on my windshield wipers and my airbag deploys, is it a documented feature if the dealership told me about this behaviour ahead of time? Well it's more like my car where the

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Greg Stark
Scott Marlowe [EMAIL PROTECTED] writes: Sorry, but it's worse than that. It is quite possible that two people could run this query at the same time and get different data from the same set and the same point in time. That shouldn't happen accidentally in SQL, you should know it's coming.

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Scott Marlowe
On Thu, 2005-10-13 at 13:26, Greg Stark wrote: Scott Marlowe [EMAIL PROTECTED] writes: Sorry, but it's worse than that. It is quite possible that two people could run this query at the same time and get different data from the same set and the same point in time. That shouldn't happen

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Andrew Sullivan
On Thu, Oct 13, 2005 at 02:26:58PM -0400, Greg Stark wrote: Scott Marlowe [EMAIL PROTECTED] writes: could run this query at the same time and get different data from the same set and the same point in time. I'm pretty unsympathetic to the we should make a language less powerful and more

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Anthony Molinaro
: Greg Stark; Stephan Szabo; Rick Schumeyer; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause Scott Marlowe [EMAIL PROTECTED] writes: Sorry, but it's worse than that. It is quite possible that two people could run this query at the same time and get different

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Tom Lane
In standard SQL you have to write GROUP BY ... and list every single column you need from the master table. This thread seems to have gone off on a tangent that depends on the assumption that the above is a correct statement. It's not. It *was* true, in SQL92, but SQL99 lets you omit

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Anthony Molinaro
; Stephan Szabo; Rick Schumeyer; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause In standard SQL you have to write GROUP BY ... and list every single column you need from the master table. This thread seems to have gone off on a tangent that depends

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Tom Lane
Anthony Molinaro [EMAIL PROTECTED] writes: An additional gripe is that this isn't a good feature (standard or not). Oracle doesn't do it. Db2 doesn't do it. You sure about that? It's hard to believe that the SQL committee would put a feature into the spec that neither Oracle nor IBM intended

Re: [SQL] pg, mysql comparison with group by clause

2005-10-13 Thread Anthony Molinaro
:[EMAIL PROTECTED] Sent: Thursday, October 13, 2005 3:17 PM To: Anthony Molinaro Cc: Scott Marlowe; Greg Stark; Stephan Szabo; Rick Schumeyer; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause Anthony Molinaro [EMAIL PROTECTED] writes: An additional gripe

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Greg Stark
Stephan Szabo [EMAIL PROTECTED] writes: On Tue, 11 Oct 2005, Rick Schumeyer wrote: I'm not sure what I was thinking, but I tried the following query in pg: SELECT * FROM t GROUP BY state; pg returns an error. Mysql, OTOH, returns the first row for each state. (The first row with

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Scott Marlowe
On Wed, 2005-10-12 at 16:54, Greg Stark wrote: Stephan Szabo [EMAIL PROTECTED] writes: On Tue, 11 Oct 2005, Rick Schumeyer wrote: I'm not sure what I was thinking, but I tried the following query in pg: SELECT * FROM t GROUP BY state; pg returns an error. Mysql, OTOH,

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Anthony Molinaro
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Marlowe Sent: Wednesday, October 12, 2005 6:25 PM To: Greg Stark Cc: Stephan Szabo; Rick Schumeyer; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause On Wed, 2005-10-12

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Greg Stark
Scott Marlowe [EMAIL PROTECTED] writes: Hehe. When I turn on my windshield wipers and my airbag deploys, is it a documented feature if the dealership told me about this behaviour ahead of time? Well it's more like my car where the dashboard dims when I turn on my headlights which annoys me

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Tom Lane
Greg Stark [EMAIL PROTECTED] writes: I think most MySQL users don't stumble on it, they learn it as the way to handle the common use case when you join a master table against a detail table and then want to aggregate all the detail records. In standard SQL you have to write GROUP BY ... and

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Anthony Molinaro
] [mailto:[EMAIL PROTECTED] On Behalf Of Greg Stark Sent: Wednesday, October 12, 2005 9:13 PM To: Scott Marlowe Cc: Greg Stark; Stephan Szabo; Rick Schumeyer; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause Scott Marlowe [EMAIL PROTECTED] writes: Hehe. When I

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Anthony Molinaro
; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause Greg Stark [EMAIL PROTECTED] writes: I think most MySQL users don't stumble on it, they learn it as the way to handle the common use case when you join a master table against a detail table and then want

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Greg Stark
Anthony Molinaro [EMAIL PROTECTED] writes: By changing the values in the select/group by you are changing Group! How can you arbitrarily add or exclude a column? You can't do it. Go back and reread the previous posts again. You missed the whole point. -- greg

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Anthony Molinaro
, October 12, 2005 11:43 PM To: Anthony Molinaro Cc: Tom Lane; Greg Stark; Scott Marlowe; Stephan Szabo; Rick Schumeyer; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause Anthony Molinaro [EMAIL PROTECTED] writes: By changing the values in the select/group by you

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Greg Stark
Anthony Molinaro [EMAIL PROTECTED] writes: Greg, You'll have to pardon me... I saw this comment: I don't see why you think people stumble on this by accident. I think it's actually an extremely common need. Which, if referring to the ability to have items in the select that do not

Re: [SQL] pg, mysql comparison with group by clause

2005-10-12 Thread Anthony Molinaro
Marlowe; Stephan Szabo; Rick Schumeyer; pgsql-sql@postgresql.org Subject: Re: [SQL] pg, mysql comparison with group by clause Anthony Molinaro [EMAIL PROTECTED] writes: Greg, You'll have to pardon me... I saw this comment: I don't see why you think people stumble on this by accident. I

[SQL] pg, mysql comparison with group by clause

2005-10-11 Thread Rick Schumeyer
I'm not sure what I was thinking, but I tried the following query in pg: SELECT * FROM t GROUP BY state; pg returns an error. Mysql, OTOH, returns the first row for each state. (The first row with AK, the first row with PA, etc.) I'm no SQL expert, but it seems to me that the pg behavior is

Re: [SQL] pg, mysql comparison with group by clause

2005-10-11 Thread Scott Marlowe
On Tue, 2005-10-11 at 16:12, Rick Schumeyer wrote: I'm not sure what I was thinking, but I tried the following query in pg: SELECT * FROM t GROUP BY state; pg returns an error. Mysql, OTOH, returns the first row for each state. (The first row with AK, the first row with PA, etc.)

Re: [SQL] pg, mysql comparison with group by clause

2005-10-11 Thread Anthony Molinaro
You're 100% correct, this is a bug in mysql. Sadly, they tout this as a feature! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rick Schumeyer Sent: Tuesday, October 11, 2005 5:12 PM To: pgsql-sql@postgresql.org Subject: [SQL] pg, mysql comparison

Re: [SQL] pg, mysql comparison with group by clause

2005-10-11 Thread Stephan Szabo
On Tue, 11 Oct 2005, Rick Schumeyer wrote: I'm not sure what I was thinking, but I tried the following query in pg: SELECT * FROM t GROUP BY state; pg returns an error. Mysql, OTOH, returns the first row for each state. (The first row with AK, the first row with PA, etc.) I'm no SQL