Re: [SQL] How can this INSERT fail?

2012-04-25 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > I can only assume it is possible for multiple transactions to overlap and > one of them to miss the row so it doesn't appear in the EXCEPT SELECT but > the row appears before the transaction commits and so an error occurs. My > first thought w

Re: [SQL] How can this INSERT fail?

2012-04-25 Thread Peter Harris
It is 9.0.4 if that helps. Is there some reason it should work differently on 9.1 or 8.x? On 25 April 2012 13:29, Abbas wrote: > Which version of postgresql it is ? > > Best Regards, > Abbas > > > > On Wed, Apr 25, 2012 at 5:15 PM, Peter Harris > wrote: > >> I'm trying to INSERT into a table, a

Re: [SQL] How can this INSERT fail?

2012-04-25 Thread Abbas
Which version of postgresql it is ? Best Regards, Abbas On Wed, Apr 25, 2012 at 5:15 PM, Peter Harris wrote: > I'm trying to INSERT into a table, avoiding duplicates, using this sort of > thing: > -- -- > insert into buddyinvite (bi_user, bi_invited) > select 'a', 'b' > except > select bi

[SQL] How can this INSERT fail?

2012-04-25 Thread Peter Harris
I'm trying to INSERT into a table, avoiding duplicates, using this sort of thing: -- -- insert into buddyinvite (bi_user, bi_invited) select 'a', 'b' except select bi_user, bi_invited from buddyinvite where bi_user = 'a' and bi_invited = 'b' -- -- I thought this should work, because if such a