Re: Writeable CTEs

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>, Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Writeable CTEs
Date: 2010-01-05 21:46:48
Message-ID: 603c8f071001051346q643aa537xa9253029e1f9a69b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 5, 2010 at 4:20 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> On 1/5/10 9:45 AM, Marko Tiikkaja wrote:
>> On 2010-01-05 19:21 +0200, Greg Stark wrote:
>>> 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.
>>
>> I probably wasn't clear about the actual problem in the original post.
>> The problem only affects INSERT, UDPATE and DELETE where you are
>> actually counting affected rows (i.e. PQcmdTuples(), not PQntuples()) so
>> the this example would work as expected.
>
> I don't think there is an "as expected" for this situation; people won't
> know what to expect. So what do we think is resonable?  The current
> behavior, which reports the total count of rows expected, works for me.

I agree with Tom's statement upthread that we should only count the
rows affected by the top-level query. Anything else seems extremely
counter-intuitive.

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-01-05 21:54:00 pgsql: Support ALTER TABLESPACE name SET/RESET ( tablespace_options ).
Previous Message Robert Haas 2010-01-05 21:45:18 Re: Stats for inheritance trees