Search Postgresql Archives

Re: Getting actual number of rows updated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux