Re: Getting actual number of rows updated - Mailing list pgsql-general

From Tino Wildenhain
Subject Re: Getting actual number of rows updated
Date
Msg-id 1123490337.15416.103.camel@sabrina.peacock.de
Whole thread Raw
In response to Getting actual number of rows updated  (CSN <cool_screen_name90001@yahoo.com>)
List pgsql-general
Am Montag, den 08.08.2005, 00:32 -0700 schrieb CSN:
> Is it possible to have PG report the actual number of
> rows that actually CHANGED in an update command? e.g.
>
> UPDATE items set name=replace(name,'abc','def');
> UPDATE 9000 -- Actually only 3 were changed
>
> rather than update reporting all rows have been
> "updated"?

Since you have no where clause all rows have indeed been
updated. No matter if you write the same data which is
already in the row the update happens nevertheless.

(How would PG know? Also there might be a trigger or
something. So best is to just do what you request)

Add a where clause like WHERE name ~'abc';

And both you and PG will be happy :-)
--
Tino Wildenhain <tino@wildenhain.de>


pgsql-general by date:

Previous
From: Patrick.FICHE@AQSACOM.COM
Date:
Subject: Re: Getting actual number of rows updated
Next
From: Lipy Reis
Date:
Subject: remove