Skip site navigation (1) Skip section navigation (2)

Re: Update & Lack of Error Message

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: operationsengineer1(at)yahoo(dot)com
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Update & Lack of Error Message
Date: 2006-01-26 22:53:41
Message-ID: 20060126225341.GA99170@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-novice
On Thu, Jan 26, 2006 at 02:22:37PM -0800, operationsengineer1(at)yahoo(dot)com wrote:
> i set up an update statement to update a unit's status
> from incomplete to completed.
> 
> however, pgsql doesn't kick out an error message when
> i try to update something that doesn't exist.

The database has no way of knowing that a certain number of rows
updated (zero in your case) represents an error; that's something
the application knows.  An update that affects zero rows is perfectly
legitimate in many applications.

> i'm thinking about running a select to check the
> existence of the serial number before running the
> update.  that way, i can check that the serial 1.
> exists and 2. hasn't already been updated and, based
> on the result, kick out a message to the user as
> appropriate.

Your API should provide a way to get the number of rows updated.
What language and database interface are you using?

-- 
Michael Fuhr

In response to

Responses

pgsql-novice by date

Next:From: operationsengineer1Date: 2006-01-27 00:13:45
Subject: Re: Update & Lack of Error Message
Previous:From: operationsengineer1Date: 2006-01-26 22:22:37
Subject: Update & Lack of Error Message

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group