Re: Insert behavior in transaction

From: "Andres" <andres1981(at)gawab(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Insert behavior in transaction
Date: 2005-06-20 02:08:50
Message-ID: 20050620020850.14725.qmail@gawab.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


But, does it have solution ??

You are right, the second insert imply a unique-key violation,
but what to do in that cases?

Thanks for your help and attention!

Tom Lane writes:

> "Andres" <andres1981(at)gawab(dot)com> writes:
>> I did this simple test and it fails too.
>
>> BEGIN (first transaction)
>> INSERT INTO mytable VALUES(1);
>
>> On other client
>> BEGIN (second transaction)
>> INSERT INTO mytable VALUES(0);
>> INSERT INTO mytable VALUES(1);
>
>> and it freezes waiting for the first o commit or rollback
>
> Not too surprising if the second insert would imply a unique-key
> violation. It has to wait to see if the first insertion of "1"
> is going to commit or not.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Milan Krcmar 2005-06-20 02:33:43 External (asynchronous) notifications of database updates
Previous Message John DeSoi 2005-06-20 01:40:49 Re: user/groups query ?