Re: INSERT ... RETURNING in v8.2 - Mailing list pgsql-general

From Tom Lane
Subject Re: INSERT ... RETURNING in v8.2
Date
Msg-id 8539.1181665244@sss.pgh.pa.us
Whole thread Raw
In response to INSERT ... RETURNING in v8.2  (Vincenzo Romano <vincenzo.romano@gmail.com>)
List pgsql-general
Vincenzo Romano <vincenzo.romano@gmail.com> writes:
> 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.
> Am I doing anything wrong or is there some missing sentence in the
> documentation?

I would think the error message you get would make it pretty plain
that this wasn't just an oversight:

regression=# insert into int4_tbl default values returning count(*);
ERROR:  cannot use aggregate function in RETURNING

RETURNING is supposed to return one row per inserted/deleted/updated
tuple, so what you suggest isn't sensible.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: PL/PGSQL rowtype return problem
Next
From: Tom Lane
Date:
Subject: Re: INSERT ... RETURNING in v8.2