Table locking.

Поиск
Список
Период
Сортировка
От Michael Richards
Тема Table locking.
Дата
Msg-id 3A5D2611.00001D.86746@frodo.searchcanada.ca
обсуждение исходный текст
Список pgsql-sql
Hi.

I've always had trouble understanding how to properly deal with the 
following case.

I need to run an insert on a table but I don't want any other 
transactions to commit the insert before me. Within the logic of the 
program, I run a select to see if there is a value there, then the 
insert. Between these 2 statements someone could commit one that 
causes the insert to fail.

Is there a better way to do this than locking the table in SHARE ROW 
EXCLUSIVE MODE and trying to be certain that anything else that may 
call an insert there asks for the same type of lock?

-Michael
_________________________________________________________________    http://fastmail.ca/ - Fast Free Web Email for
Canadians

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

Предыдущее
От: Joel Burton
Дата:
Сообщение: Re: connecting to postgres server from Access
Следующее
От: Vince Vielhaber
Дата:
Сообщение: Re: [HACKERS] Re: PostgreSQL web page