Re: UPDATE w/ subselect doing locking

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: UPDATE w/ subselect doing locking
Дата
Msg-id 20011115112703.E9260-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: UPDATE w/ subselect doing locking  (David Ford <david@blue-labs.org>)
Список pgsql-general
On Thu, 15 Nov 2001, David Ford wrote:

> Yes, I know that works.  I want to figure out how to use SELECT ... FOR
> UPDATE with UPDATE because I will have a need to lock these certain rows
> and do a bit more than just 'count'.
>
> >>bluelist=> UPDATE spamcontrol SET count=foo.count+1 FROM (SELECT count
> >>FROM spamcontrol WHERE regex='setup fees' FOR UPDATE) as foo;

In general the problem you're running into in your query is that you're
not specifying which values in foo go with which values in spamcontrol.
You're not limiting the update to only the rows that have 'setup fees'
you're updating all rows with a value from the row that has 'setup fees'.


В списке pgsql-general по дате отправления:

Предыдущее
От: "Andrew G. Hammond"
Дата:
Сообщение: Re: Modifying check constraints
Следующее
От: wsheldah@lexmark.com
Дата:
Сообщение: Re: Idle in transaction ????