Re: UPDATE w/ subselect doing locking

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: David Ford <dford(at)erisksecurity(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: UPDATE w/ subselect doing locking
Date: 2001-11-15 14:43:19
Message-ID: 20011116014319.C3148@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 14, 2001 at 02:34:51AM -0500, David Ford wrote:
> bluelist=> UPDATE spamcontrol SET count=foo.count+1 FROM (SELECT count
> FROM spamcontrol WHERE regex='setup fees' FOR UPDATE) as foo;
>
> How do I get it to only update that one row?

What's the problem with:

UPDATE spamcontrol SET count=count+1 WHERE regex='setup fees';

HTH,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Brett 2001-11-15 14:44:56 libpq.dll function descriptions ... ?
Previous Message Martijn van Oosterhout 2001-11-15 14:41:18 Re: Serial data type not starting at 1