RE: Re: Unanswered questions about Postgre

Поиск
Список
Период
Сортировка
От Roger Wernersson
Тема RE: Re: Unanswered questions about Postgre
Дата
Msg-id 5146853DD571D411AC54000102070D610125C4@MINGBGNTS02
обсуждение исходный текст
Ответ на Unanswered questions about Postgre  (Joe Kislo <pgsql@athenium.com>)
Ответы RE: Re: Unanswered questions about Postgre  ("Edward Q. Bridges" <ed.bridges@buzznik.com>)
Список pgsql-general
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
Дата:
Сообщение: Which character data type to use?
Следующее
От: "Mayers, Philip J"
Дата:
Сообщение: LIKE with macaddr types