Re: serialization errors

Поиск
Список
Период
Сортировка
От Greg Copeland
Тема Re: serialization errors
Дата
Msg-id 1043955519.10917.11.camel@mouse.copelandconsulting.net
обсуждение исходный текст
Ответ на Re: serialization errors  (Ryan VanderBijl <rvbijl-pgsql@vanderbijlfamily.com>)
Ответы Re: serialization errors  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
On Thu, 2003-01-30 at 13:00, Ryan VanderBijl wrote:
> I guess I'm starting to sound like a broken record here, but I'm struggling
> to understand why it should say unique constraint violated instead of serial.
>

Because, the "select max(node_order)+1" will select the identical value
in multiple sessions.  Done concurrently, it results in unique
constraint violation on your insert, even if the inserts are serialized.

--------------------
session 1; parallel:
    select max(node_order)+1 = 5

session 2; parallel:
    select max(node_order)+1 = 5

--------------------
session 1, session 2; serialized:
    insert into x ( order ) values ( 5 )
    insert into x ( order ) values ( 5 )

As you can see from the fast and crude example, serializing the inserts
are not going to protect you from attempting to insert the same value
into your table twice.

That help clarify it?  Then again, perhaps I misunderstood what you're
trying to do.... ;)


Regards,


--
Greg Copeland <greg@copelandconsulting.net>
Copeland Computer Consulting


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

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: Website troubles
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Website troubles