Re: Feedback about Drupal SQL debugging - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Feedback about Drupal SQL debugging
Date
Msg-id 407d949e0908211831r18cb498av5fc172b96210317f@mail.gmail.com
Whole thread Raw
In response to Re: Feedback about Drupal SQL debugging  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Feedback about Drupal SQL debugging  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
2009/8/22 Stephen Frost <sfrost@snowman.net>:
> * Greg Stark (gsstark@mit.edu) wrote:
>> You would have to specify the key. I think typically you would have
>> something like:
>>
>> SELECT a.*, sum(b.col)
>>    FROM a,b
>>  GROUP BY a.pk
>
> Ahhh, ok, this makes more sense.  This is SQL standard?

Incidentally it makes even more sense that MySQL would do what they do
when you remember that they didn't have subqueries until recently. So
MySQL programmers had all become accustomed to the circumlocutions
like:

SELECT a.*   FROM a left join b USING (a.b_id = b.id)WHERE b.id IS NULLGROUP BY a.id

to express the much simpler

select * from a where b_id in (select id from b)

So not many uses of it in MySQL actually *would* be valid if we
implemented the shortcut. But MySQL doesn't enforce that so it serves
that purpose as well as what we get out of DISTINCT ON.

--
greg
http://mit.edu/~gsstark/resume.pdf


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Feedback about Drupal SQL debugging
Next
From: Stephen Frost
Date:
Subject: Re: Feedback about Drupal SQL debugging