From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | Ewald Geschwinde <webmaster(at)geschwinde(dot)net>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: group by |
Date: | 2002-01-15 19:55:47 |
Message-ID: | web-620227@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Ewald,
> select s1.channelname as channelname, s1.id as channelid,
> count(*) as anz from mgw_news n left join mgw_news_channels s1 on
> n.channelid = s1.id group by channelid, channelname order by channelid,
> channelname
>
> this runs under mysql and postgresql seems not to accept aliases in group by
>
> cause when i'm changing channelid to s1.id it works perfectly
I believe that the PostgreSQL behavior, i.e. not accepting the real names of
columns that have been aliased, is the SQL92 standard behavior. Certainly it
prevents a certain confusion in the query parser in the case of multiple
references to an aliased column.
In other words, I believe that the behavior you are observing is by design and
is not a bug. Please keep in mind that MySQL does *not* uphold the SQL92
standard, so it cannot be used as an index of proper behavior. So, change
your GROUP BY reference.
However, the behavior you mention should certainly be mentioned in one or more
of the porting articles at TechDocs ( http://techdocs.postgresql.org/ ).
E-mail one of the authors if it's not.
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-01-15 20:03:52 | Re: group by |
Previous Message | Ewald Geschwinde | 2002-01-15 18:49:45 | group by |