Re: getting the number of rows affected by a query

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: getting the number of rows affected by a query
Date: 2007-11-16 09:03:40
Message-ID: 1195203820.29253.41.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Fri, 2007-11-16 at 09:00 +0800, Ow Mun Heng wrote:
> I'm trying to do some periodic updates from another DB and would like to
> know the # of updates/inserts/deletes from that job.
>
> I usually write a function which gets/uses the GETS DIAGNOSTIC ROW COUNT
> parameter which will tell me how many rows were affected by the query.
>
> Now, for this case, I'm not writing a function but merely using a normal
> SQL eg:
>
> BEGIN;
>
> DELETE FROM foo where (x) = (select x from foobar);
>
> INSERT INTO foo select * from foobar;
>
> -- then I would like to update a log_table
> -- eg: insert into log(proc,tablname,ins_row,delete_rows)
> -- values ('update','foo',XXX,YYY)
>
> COMMIT;
>
> Is there a way to do this?

Hmm.. no response..
and I've yet to be able to find out how to get this done.
Would really appreciate some help..

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Trevor Talbot 2007-11-16 09:07:21 Re: Variable LIMIT and OFFSET in SELECTs
Previous Message Reg Me Please 2007-11-16 08:57:44 Re: Variable LIMIT and OFFSET in SELECTs