Re: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVIN G

Поиск
Список
Период
Сортировка
От Zeugswetter Andreas SB
Тема Re: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVIN G
Дата
Msg-id 219F68D65015D011A8E000006F8590C603FDC1CE@sdexcsrv1.f000.d0188.sd.spardat.at
обсуждение исходный текст
Список pgsql-hackers
> Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
> > Informix and DB/2 allow column numbering in the group by clause.
> 
> What do they do with
> 
>     SELECT foo AS bar FROM table GROUP BY bar
> 
> What do they do if bar is the real name of another column in 
> the table?

They don't allow labels, only numbers, 
(SELECT foo AS bar FROM table GROUP BY 1)

In the special case where a label collides with a colname,
we need to use the colname, because that behavior is 
ruled by the standard (since it doesn't allow a label).

The order by clause is the other way around.

DB Vendors probably disallow this syntax,
because the two different interpretations would be a bit awkward.

Best would of course be if the standard allowed labels in the 
group by and where clause and take label before colname.

Andreas


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Finding corrupt data
Следующее
От: Zeugswetter Andreas SB
Дата:
Сообщение: AW: [HACKERS] SELECT ... AS ... names in WHERE/GROUP BY/HAVING