On Tue, Jan 5, 2010 at 4:42 PM, Marko Tiikkaja
<marko.tiikkaja@cs.helsinki.fi> wrote:
> => with t as (delete from foo returning *)
> -> insert into bar
> -> select * from t;
> INSERT 0 2
>
> It correctly reports 2 affected rows (one deleted and one inserted), but is
> this the answer we want? It doesn't seem all that useful to know the total
> amount of affected rows.
My first thought is that the number should correspond to the INSERT.
It didn't INSERT two rows so it seems wrong. More importantly in a
case like
with t as (delete from foo returning *)
select * from t where x=?
applications will almost certainly expect the number to match the
actual number of rows returned and may well misbehave if they don't.
--
greg