getting the number of rows affected by a query - Mailing list pgsql-general

From Ow Mun Heng
Subject getting the number of rows affected by a query
Date
Msg-id 1195174846.26962.9.camel@neuromancer.home.net
Whole thread Raw
Responses Re: getting the number of rows affected by a query  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
Re: getting the number of rows affected by a query  (Martijn van Oosterhout <kleptog@svana.org>)
Re: getting the number of rows affected by a query  (Sam Mason <sam@samason.me.uk>)
List pgsql-general
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?


pgsql-general by date:

Previous
From: "Sean Davis"
Date:
Subject: Re: XML schema
Next
From: Stephen Frost
Date:
Subject: Re: Tom thinks it's bad code was 8.3 vs 8.2 sql compatibility issue