Re: begin transaction locks out other connections

Поиск
Список
Период
Сортировка
Искать
От
Craig Ringer
Тема
Re: begin transaction locks out other connections
Дата
Msg-id
47FF268A.5050007@postnewspapers.com.au
Ответ на
Список
Дерево обсуждения
begin transaction locks out other connections Ivano Luberti <luberti@archicoop.it>
Re: begin transaction locks out other connections Richard Huxton <dev@archonet.com>
Re: begin transaction locks out other connections Ivano Luberti <luberti@archicoop.it>
Re: begin transaction locks out other connections "Pavan Deolasee" <pavan.deolasee@gmail.com>
Re: begin transaction locks out other connections "Dennis Brakhane" <brakhane@googlemail.com>
Re: begin transaction locks out other connections "Pavan Deolasee" <pavan.deolasee@gmail.com>
Re: begin transaction locks out other connections Craig Ringer <craig@postnewspapers.com.au>
Dennis Brakhane wrote:
> On Thu, Apr 10, 2008 at 4:40 PM, Pavan Deolasee
>  wrote:
>   
>> On Thu, Apr 10, 2008 at 7:18 PM, Ivano Luberti  wrote:
>>
>>  I think that's because Postgres does not have deferred constraint checks.
>>     
>
> I believe it does. See
> http://www.postgresql.org/docs/8.3/interactive/sql-set-constraints.html
> and the DEFERRABLE keyword in CREATE TABLE.
>
> Or am I missing something here?
>
>   
As far as I know UNIQUE and CHECK constraints cannot be deferrable; only 
FOREIGN KEY constraints can be deferrable. You can use a CONSTRAINT 
TRIGGER to emulate others though.

I'm told some other databases can defer UNIQUE constraint checks, but I 
haven't the foggiest how that can work in a remotely sane way. Wouldn't  
a deferred UNIQUE constraint be useless to the query planner (which 
can't trust that the data is really unique right now) and cause 
confusing behaviour with scalar subqueries (that might suddenly not 
return a single result) and stored procedures that rely on the unique 
constraint?

I guess the same thing applies to a deferred foreign key constraint, 
really - you can't actually trust it in any context where you're 
modifying the data involved. It just seems a lot simpler to think about 
the effects of deferred foreign key constraints.

--
Craig Ringer

В списке pgsql-general по дате отправления
От: Craig Ringer
Дата:
От: Gong
Дата:
FAQ