Re: Duplicate key insert question

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Duplicate key insert question
Дата
Msg-id 20030702011602.GL27363@dcc.uchile.cl
обсуждение исходный текст
Ответ на Re: Duplicate key insert question  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
On Wed, Jul 02, 2003 at 09:58:28AM +0900, Jean-Christian Imbeault wrote:
> Alvaro Herrera wrote:
> >
> > No, only the "second" one will fail (though it's difficult which one is
> > the second)
>
> I couldn't get the link to work so I couldn't read why Tom shot it down.
> But if Tom shot down this idea down ... then it mustn't be correct.

The thread is here:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3A4D6116.1A613402%40mascari.com&rnum=1&prev=/groups%3Fq%3DMike%2BMascari%2BINSERT%2BNOT%2BEXISTS%26ie%3D

The solution is not correct in that there _is_ a race condition.

> > You should check the returned value from the insertion
> > function to see if it succeeded or not.
>
> No, what I want if to have one query that will *always* insert if there
> is no record with this primary key and *always* do nothing (not fail,
> not generate an error) if there is already a record with this primary
> key. I don't want to check return values :)

No way.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"No es bueno caminar con un hombre muerto"

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: PSQL NEWBIE - RUNTIME ERROR
Следующее
От: "Reuben D. Budiardja"
Дата:
Сообщение: Re: Duplicate key insert question