Re: ERROR: cannot use aggregate function in RETURNING (in UPDATE)

Поиск
Список
Период
Сортировка
От dinesh
Тема Re: ERROR: cannot use aggregate function in RETURNING (in UPDATE)
Дата
Msg-id 008d01ce2931$92e26550$b8a72ff0$@vssod.com
обсуждение исходный текст
Ответ на Re: ERROR: cannot use aggregate function in RETURNING (in UPDATE)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice

Thanks Tom, that worked out great.

 

--

Regards

Dinesh

 

From: Tom Lane-2 [via PostgreSQL] [mailto:[hidden email]]
Sent: Sunday, March 24, 2013 3:26 PM
To: dinesh
Subject: Re: ERROR: cannot use aggregate function in RETURNING (in UPDATE)

 

dinesh <[hidden email]> writes:
> I get an error saying cannot use aggregate function in RETURNING.
> Is this a bug or a feature?

Well, it's not a bug.  RETURNING is defined as returning one row per
row inserted/updated/deleted, so aggregates are nonsensical there.

In recent versions you could put the UPDATE RETURNING inside a WITH,
and then do the aggregation in a SELECT over that.

                        regards, tom lane


--
Sent via pgsql-novice mailing list ([hidden email])
To make changes to your subscription:
click here.
NAML



View this message in context: RE: ERROR: cannot use aggregate function in RETURNING (in UPDATE)
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ERROR: cannot use aggregate function in RETURNING (in UPDATE)
Следующее
От: kobolds
Дата:
Сообщение: about .pgpass