Re: INSERT ... RETURNING in v8.2

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: INSERT ... RETURNING in v8.2
Дата
Msg-id 20070612143505.GB26937@svana.org
обсуждение исходный текст
Ответ на INSERT ... RETURNING in v8.2  (Vincenzo Romano <vincenzo.romano@gmail.com>)
Ответы Re: INSERT ... RETURNING in v8.2  (Vincenzo Romano <vincenzo.romano@gmail.com>)
Список pgsql-general
On Tue, Jun 12, 2007 at 04:18:32PM +0200, Vincenzo Romano wrote:
> Well, at least on v8.2.4 I cannot return count(*), that is the
> number of lines actually inserted into the table. Nor I can return
> any aggregate function of them.

I don't think anybody considered the possibility of using an aggregate
there, primary because for an aggregate you need a group by. What has
been discussed is nested statements, like:

SELECT a, count(*) FROM
  (INSERT <foo> RETURNING a, b)
GROUP BY a;

But I don't think that's implemented (the interactions with triggers
havn't been worked out I think)

> Amk I doing anything wrong or is there some missing sentence in the
> documentation?

When the docs talk about an "expression" they don't mean aggregates,
since they are not functions in the ordinary sense.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: Vincenzo Romano
Дата:
Сообщение: INSERT ... RETURNING in v8.2
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: PL/PGSQL rowtype return pr