Re: Rule updates and PQcmdstatus() issue - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: Rule updates and PQcmdstatus() issue
Date
Msg-id 20020909105818.S14235-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: Rule updates and PQcmdstatus() issue  (Steve Howe <howe@carcass.dhs.org>)
List pgsql-hackers
On Mon, 9 Sep 2002, Steve Howe wrote:

> JW> Steve Howe wrote:
> >>
> >> Hello all,
> >>
> >> PostgreSQL *still* has a bug where PQcmdStatus() won't return the
> >> number of rows updated. But that is essential for applications, since
> >> without it of course we don't know if the updates/delete/insert
> >> commands succeded. Even worst, on interfaces like Delphi/dbExpress the
> >> program will return an error message and rollback transaction thinking
> >> nothing have been updated. In other words, unusable.

As a note, I assume you realize that it returning any number doesn't
guarantee that the command succeeded if you assume succeeding means doing
what the statement sent would appear to do. ;) Although I think
we need to change the current behavior, we are turning a false "failure"
into a potentially false "success" (I did an update, it said two rows were
changed but there's no visible data change in the entire system?)
Fortunately, the likely bad effects from the false "success" are probably
only going to happen in somewhat degenerate cases.

I quote "failure" and "success" because there's already a notion of
success and failure which is raising an exception condition or not (AFAICT
0 rows is a completion condition - the statement succeeded but nothing was
modified). As such, using the count to determine success of the statement
is wrong for an interface, but it may be meaningful for applications
attempting to apply some sort of business logic.



pgsql-hackers by date:

Previous
From: Rod Taylor
Date:
Subject: Re: Rule updates and PQcmdstatus() issue
Next
From: "Dann Corbit"
Date:
Subject: Re: Rule updates and PQcmdstatus() issue