Getting number of affected rows after DELETE FROM

From: Raimon Fernandez <coder(at)montx(dot)com>
To: pgsql-general List <pgsql-general(at)postgresql(dot)org>
Subject: Getting number of affected rows after DELETE FROM
Date: 2010-12-17 22:49:09
Message-ID: 0654C853-A700-457E-88E4-F80FBE1E0295@montx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 rows were 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 the action 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 get those 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't make them work outside their main function.

There is something like select lastval(); but for rows affected ?

thanks in advance,

regards,

r.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex - 2010-12-18 06:50:52 Postgres 9.0 Hiding CONTEXT string in Logs
Previous Message Tom Lane 2010-12-17 22:43:21 Re: DB files, sizes and cleanup