Re: Duplicate key insert question - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject Re: Duplicate key insert question
Date
Msg-id 3F022E34.1040808@mega-bucks.co.jp
Whole thread Raw
In response to Duplicate key insert question  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Responses Re: Duplicate key insert question
Re: Duplicate key insert question
List pgsql-general
Alvaro Herrera wrote:
>
> No, only the "second" one will fail (though it's difficult which one is
> the second)

From:

http://marc.theaimsgroup.com/?l=postgresql-general&m=105656988915991&w=2

Ian Barwick wrote:

[...]

I proposed that same solution 3 years ago. Tom shoots it down:

[...]

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.

>>If I followed all the arguments correctly according to the thread there
>>is *no* way to do what I (and you ;) want in one simple query.
>
>
> No, there's not.

You say no, but at first you say that the proposed method works. The
proposed method, if it is correct, is simple enough for me. By simple I
mean all can be done with one query.

> 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 :)

Thanks,

Jean-Christian Imbeault


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Duplicate key insert question
Next
From: "Maksim Likharev"
Date:
Subject: Re: Duplicate key insert question