Re: getting the number of rows affected by a query

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Sam Mason" <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: getting the number of rows affected by a query
Date: 2007-11-16 13:11:39
Message-ID: 162867790711160511g58e08d36iff5df7efb091f69a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 16/11/2007, Sam Mason <sam(at)samason(dot)me(dot)uk> wrote:
> On Fri, Nov 16, 2007 at 12:51:07PM +0000, Raymond O'Donnell wrote:
> > On 16/11/2007 10:02, Sam Mason wrote:
> >
> > > SELECT COUNT(*) FROM (
> > > DELETE FROM foo RETURNING 1) x;
> >
> > I haven't played with this yet, but AFAICS this will simply return the
> > integer value "1".
>
> I currently get a syntax error, hence the way I wrote my message.
>
> I'd not expect it to return 1 though. The "1" is there simply to be
> easy to evaluate, maybe "*" would have been better. This 1 would get
> returned to the outer query, which would end up counting the number of
> rows deleted.
>

Using RETRNING clause in subselects are not supported yet. Look to ToDo.

Regards
Pavel Stehule

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark Niedzielski 2007-11-16 13:41:37 Re: Linux v.s. Mac OS-X Performance
Previous Message Sam Mason 2007-11-16 13:06:24 Re: unexplainable error