Re: [SQL] Select & Tables X Select & Views

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] Select & Tables X Select & Views
Дата
Msg-id 29583.951172028@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] Select & Tables X Select & Views  (Rodrigo Rezende <Rodrigo.Rezende@hortolandia.marelli.it>)
Список pgsql-sql
Rodrigo Rezende <Rodrigo.Rezende@hortolandia.marelli.it> writes:
> The view :
> create view func_aux_stat as select fp.codfuncionario, max(fp.data) as
> data from func_preench as fp group by fp.codfuncionario ;

Ah.  I'm afraid GROUP BY doesn't work very well in views --- it's OK
for simply selecting from the grouped view, but not for joining it
against other tables.  This is because the rule rewriter can only
revise your query into some other query that's still expressible in
SQL, and there's no way to group only one table in a query in the
subset of SQL that we support.

We hope to fix this in 7.1, but for now it's not going to work.
You might think about trying to recast your problem to use subselects,
or some other approach that doesn't involve joining a grouped table
against an ungrouped one.
        regards, tom lane


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

Предыдущее
От: Rodrigo Rezende
Дата:
Сообщение: rule plan string too big
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [SQL] rule plan string too big