Re: INSERT ON DUPLICATE KEY UPDATE

Поиск
Список
Период
Сортировка
Искать
От
Robert Treat
Тема
Re: INSERT ON DUPLICATE KEY UPDATE
Дата
Msg-id
1087594345.2111.78.camel@camel
Ответ на
Re: INSERT ON DUPLICATE KEY UPDATE (jseymour@linxnet.com (Jim Seymour))
Список
Дерево обсуждения
Re: INSERT ON DUPLICATE KEY UPDATE Duane Lee - EGOVX <DLee@mail.maricopa.gov>
Re: INSERT ON DUPLICATE KEY UPDATE Robert Treat <xzilla@users.sourceforge.net>
Re: INSERT ON DUPLICATE KEY UPDATE jseymour@linxnet.com (Jim Seymour)
Re: INSERT ON DUPLICATE KEY UPDATE Robert Treat <xzilla@users.sourceforge.net>
Re: INSERT ON DUPLICATE KEY UPDATE Eduardo Pérez Ureta <eperez@it.uc3m.es>
Re: INSERT ON DUPLICATE KEY UPDATE Robert Treat <xzilla@users.sourceforge.net>
On Fri, 2004-06-18 at 16:41, Jim Seymour wrote:
> Robert Treat  wrote:
> > 
> [snip]
> > 
> > IIRC the main downside to the select/update method is it introduces a
> > race condition that can only be solved by locking the table; not an
> > issue for most my$ql apps but would be frowned upon by most postgresql
> > users.
> [snip]
> 
> One way around the race condition is to insert and, if the insert
> fails, do an update.  If that fails, then something is actually wrong.
> 
> One caveat regarding the above solution: Even when an insert fails, if
> there's a column with a sequence in it, that sequence will be
> incremented nonetheless.
> 

The other being that you can't do that within a transaction in
postgresql. Course that should change if alvaro gets nested transactions
done for 7.5. (go alvaro go!)

Robert Treat
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

В списке pgsql-general по дате отправления
От: Robert Treat
Дата:
От: DeJuan Jackson
Дата:
FAQ