Re: [HACKERS] Abort transaction on duplicate key error

2001-09-27 Thread Barry Lind
Haller, The way I have handled this in the past is to attempt the following insert, followed by an update if the insert doesn't insert any rows: insert into foo (fooPK, foo2) select 'valuePK', 'value2' where not exists (select 'x' from foo where fooPK = 'valuePK') if number of rows inse

Re: [HACKERS] Abort transaction on duplicate key error

2001-09-27 Thread Haller Christoph
Thanks a lot. Now that I've read your message, I wonder why I was asking something trivial. Christoph > > In a C application I want to run several > > insert commands within a chained transaction > > (for faster execution). > > >From time to time there will be an insert command > > causing an >

Re: [HACKERS] Abort transaction on duplicate key error

2001-09-27 Thread Christof Petig
Haller Christoph wrote: > My first message: > In a C application I want to run several > insert commands within a chained transaction > (for faster execution). > >From time to time there will be an insert command > causing an > ERROR: Cannot insert a duplicate key into a unique index > > As a re

[HACKERS] Abort transaction on duplicate key error

2001-09-27 Thread Haller Christoph
Hi all, Sorry for bothering you with my stuff for the second time but I haven't got any answer within two days and the problem appears fundamental, at least to me. I have a C application running to deal with meteorological data like temperature, precipitation, wind speed, wind direction, ...