Re: Writeable CTEs - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Writeable CTEs
Date
Msg-id 407d949e1001050921s20dbea72nee846c27da29bcaa@mail.gmail.com
Whole thread Raw
In response to Writeable CTEs  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
Responses Re: Writeable CTEs  (David Fetter <david@fetter.org>)
Re: Writeable CTEs  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: libpq naming on Win64
Next
From: Stefan Kaltenbrunner
Date:
Subject: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial