Re: get value after updating table

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Alain Roger <raf(dot)news(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: get value after updating table
Date: 2007-03-26 21:00:12
Message-ID: 20070326210012.GB28954@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 26, 2007 at 09:38:07PM +0200, Alain Roger wrote:
> Hi,
>
> I wrote a function which should update a table field.
> However, i would like somehow to control that update was done.
> for that i was thinking to return a boolean : true is update was done, false
> if an error happened.

I beleive in recent versions you can do things like:
> UPDATE accounts
> SET account_pwd = $2
> WHERE account_login = $1
RETURNING account_id;

If it updated it would return the ID of the row updated...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Gainty 2007-03-26 21:01:32 Re: A (hopefully) simple question re: secure pg <=> web application access
Previous Message Ron 2007-03-26 20:31:42 A (hopefully) simple question re: secure pg <=> web application access