Re: [SQL] update vs unique index

2005-07-25 Thread Alvaro Herrera
On Mon, Jul 25, 2005 at 05:58:43AM -0700, [EMAIL PROTECTED] wrote: > I can imagine why it fails. Update operates on first row, making 2 out > of 1 and that collides with second row (which has 2 as its value > already). However, when you look at the update efect as a whole > uniqueness is preserved

[SQL] update vs unique index

2005-07-25 Thread jacekp
Consider such table: CREATE TABLE test (idx integer); populated by following statements: INSERT INTO test VALUES (1); INSERT INTO test VALUES (2); INSERT INTO test VALUES (3); since idx schould be unique, we need an index CREATE UNIQUE INDEX i_test ON test(idx); Following SQL command fails: