Re: [BUGS] INSERT .. SELECT should redo SELECT if a duplicate key is found

2002-07-08 Thread Cesar Eduardo Barros
On Sat, Jul 06, 2002 at 12:18:56PM -0300, wrote: > > When you are trying to insert a row in a table with a UNIQUE constraint, > unless it already exists, you can try something like: > > INSERT INTO table (id) SELECT val WHERE NOT EXISTS (SELECT 1 FROM table WHERE id = >val) > > However, this

[BUGS] INSERT .. SELECT should redo SELECT if a duplicate key is found

2002-07-08 Thread Cesar Eduardo Barros
When you are trying to insert a row in a table with a UNIQUE constraint, unless it already exists, you can try something like: INSERT INTO table (id) SELECT val WHERE NOT EXISTS (SELECT 1 FROM table WHERE id = val) However, this does not work as expected if another backend inserts a row with th