Re: Getting number of affected rows after DELETE FROM

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: Getting number of affected rows after DELETE FROM
Дата
Msg-id iekjht$qct$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на Getting number of affected row after performing update  (Yan Cheng Cheok <yccheok@yahoo.com>)
Ответы Re: Getting number of affected rows after DELETE FROM  (Raimon Fernandez <coder@montx.com>)
Список pgsql-general
On 2010-12-17, Raimon Fernandez <coder@montx.com> wrote:
> Hi,
>
> I'm trying to solve what I think must be a real trivial question.
>
> When I use psql after every DELETE FROM table WHERE id=xxxx I get how many rows were affected, in this case, deleted.
>
> Also I've implemented the full FrontEnd/BackEnd Protocol v3 and there after a CommandComplete also I receive how many
rowswere affected. 
>
> But now, I'm using REALstudio www.realsoftware.com with their plugin, and I can't get the rows affected.
>
> I can send a simple DELETE FROM table WHERE id=xxxx  and all what I get is nothing, no rows, no set, no info, even if
theaction didn't delete any row because the id was wrong. 
>
> They say that if the DELETE gives an empty string, means that PostgreSQL isn't returning nothing and that I have to
getthose values with some special values, like return parameters. 
>
> In pg/plsql I've used sometimes the GET DIAGNOSTICS <variable> = ROW_COUNT or FOUND with great success, but I really
can'tmake them work outside their main function. 
>
> There is something like select lastval(); but for rows affected ?
>
> thanks in advance,

Easiest work-around is to add "returning true" on the end of your delete
then the delete will return some row(s) when it succeeds.

Best solution is to get realstudio to fix their plugin or use a
different framework.

--
⚂⚃ 100% natural

В списке pgsql-general по дате отправления:

Предыдущее
От: Glenn Maynard
Дата:
Сообщение: Re: FTS phrase searches
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: INSERT INTO...RETURNING with partitioned table based on trigger function