Re: Functional dependencies and GROUP BY

Поиск
Список
Период
Сортировка
От Alex Hunsaker
Тема Re: Functional dependencies and GROUP BY
Дата
Msg-id AANLkTimb1WK788F9EG1LCIzlsj30KAtxsNknrucU-tei@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Functional dependencies and GROUP BY  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Functional dependencies and GROUP BY  (Peter Eisentraut <peter_e@gmx.net>)
Re: Functional dependencies and GROUP BY  (Alex Hunsaker <badalex@gmail.com>)
Список pgsql-hackers
On Fri, Jun 25, 2010 at 14:06, Peter Eisentraut <peter_e@gmx.net> wrote:
> Second version:

Hi!

Ive looked this over.  Looks great!  I have some nits about the
documentation and comments ( non issues like referencing primary keys
when it really means not null unique indexes :-P ), but on the whole
it works and looks good.

The only corner case I have run into is creating a view with what I
would call an implicit 'not null' constraint.  Demonstration below:

create table nn (a int4 not null, b int4, unique (a));
select * from nn group by a; -- should this work? I think not?
a | b
---+---
(0 rows)

create view vv as select a, b from nn group by a;
select * from vv;a | b
---+---
(0 rows)

=# alter table nn alter column a drop not null;
=# select * from nn group by a; -- ok, broken makes sense
ERROR:  column "nn.b" must appear in the GROUP BY clause or be used in
an aggregate function
LINE 1: SELECT * from nn group by a;

=# select * from vv; -- yipes should be broken?a | b
---+---
(0 rows)

Im thinking we should not allow the "select * from nn group by a;" to
work.  Thoughts?

(FYI I do plan on doing some performance testing with large columns
later, any other requests?)


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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: SHOW TABLES
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: SHOW TABLES