Re: Rule updates and PQcmdstatus() issue

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Steve Howe <howe(at)carcass(dot)dhs(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Rule updates and PQcmdstatus() issue
Date: 2002-09-09 18:15:29
Message-ID: 20020909105818.S14235-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nick Fankhauser 2002-09-09 18:22:55 Re: Script to compute random page cost
Previous Message Rod Taylor 2002-09-09 17:55:18 Re: Rule updates and PQcmdstatus() issue