SELECT, GROUP BY, and aggregates

Поиск
Список
Период
Сортировка
От Ryan Delaney
Тема SELECT, GROUP BY, and aggregates
Дата
Msg-id 20150213050449.GQ5672@gmail.com
обсуждение исходный текст
Ответы Re: SELECT, GROUP BY, and aggregates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Why couldn't an RDBMS such as postgres interpret a SELECT that omits the GROUP
BY as implicitly grouping by all the columns that aren't part of an aggregate?

If I do this, Postgres throws an exception that I cannot SELECT a series of
columns including an aggregate without a corresponding GROUP BY clause. But it
knew to throw the error, right?  It must have some method of knowing which
columns aren't part of an aggregate.  Or is it that a column might not have an
aggregate, but still be hard to figure out how to group by it?

But how would that happen?

If I omit something from GROUP BY, it throws another exception. If I put
something there that doesn't belong, I get a different exception. So it already
knows how to do this! :P
--
Regards,
Ryan Delaney
ryan.delaney@gmail.com
https://github.com/rpdelaney
GPG ID: 4096R/311C 10F2 26E0 14E3 8BA4  3B06 B634 36F1 C9E7 771B

Вложения

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

Предыдущее
От: seb
Дата:
Сообщение: No repo for postgresql 9.4 for raspberry pi 2
Следующее
От: Saimon Lim
Дата:
Сообщение: Re: How to hide stored procedure's bodies from specific user