RE: Re: Unanswered questions about Postgre

Поиск
Список
Период
Сортировка
Искать
От
Roger Wernersson
Тема
RE: Re: Unanswered questions about Postgre
Дата
Msg-id
5146853DD571D411AC54000102070D610125C4@MINGBGNTS02
Список
Дерево обсуждения
RE: Re: Unanswered questions about Postgre Roger Wernersson <roger.wernersson@mindark.com>
How do you mean "reliable"?

This raises an interesting question though. How do I _reliably_ INSERT or
UPDATE a row?

I can't INSERT - fail - UPDATE as someone might delete the record in between
my two statements.

I can't BEGIN - INSERT - fail - UPDATE - COMMIT as the failing INSERT will
invalidate my transaction (stupid).

I can't BEGIN - SELECT FOR UPDATE - INSERT or UPDATE - COMMIT as someone
might insert after my SELECT and before my INSERT.

Is there a right solution?

/Roger

-----Original Message-----
From: Tim Kientzle [mailto:kientzle@acm.org]
Sent: den 12 december 2000 02:10
To: PostgreSQL general mailing list
Subject: [GENERAL] Re: Unanswered questions about Postgre


> Of course, people really shouldn't be inserting
> objects which already exist, ...

On the contrary, the best way to test if
something already exists is to just try the
INSERT and let the database tell you if
it's already there.  Both faster and more
reliable than doing SELECT then INSERT.

			- Tim
В списке pgsql-general по дате отправления
От: martin.chantler@convergys.com
Дата:
От: Mayers, Philip J
Дата:
Сообщение: LIKE with macaddr types
FAQ