| From: | dima(dot)kagan(at)gmail(dot)com |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Non-unique values problem after 'add column' |
| Date: | 2007-11-26 09:06:28 |
| Message-ID: | 87677990-ef0d-4104-8216-092106341455@i29g2000prf.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrus | 2007-11-26 11:29:50 | Re: Why LIMIT and OFFSET are commutative |
| Previous Message | Simon Riggs | 2007-11-26 07:38:37 | Re: replication in Postgres |