Re: Getting actual number of rows updated

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: Getting actual number of rows updated
Дата
Msg-id 1123490337.15416.103.camel@sabrina.peacock.de
обсуждение исходный текст
Ответ на Getting actual number of rows updated  (CSN <cool_screen_name90001@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Patrick.FICHE@AQSACOM.COM
Дата:
Сообщение: Re: Getting actual number of rows updated
Следующее
От: Lipy Reis
Дата:
Сообщение: remove