Hello!
I've encountered a very strange problem with Postgresql 7.3.
I have the following set of queries running in transaction, using
libpqxx 2.6.9:
ALTER TABLE my_table ADD new_column TEXT
UPDATE my_table SET new_column = 'disable'
ALTER TABLE my_table ALTER COLUMN new_column SET DEFAULT 'disable'
CREATE UNIQUE INDEX my_index ON my_table (old_column)
The last query fails with:
ERROR: Cannot create unique index. Table contains non-unique values
Running the same set of queries manually causes no problems. Moreover,
running the last query in a separate transaction works as well.
Why is a new column affecting unique index creation on an already
existing one? Is there any workaround for this issue?
Thank you,
Dima Kagan