A
A
Anton2016-05-19 13:33:27
PostgreSQL
Anton, 2016-05-19 13:33:27

How to remove Unique in PostgreSQL?

Created a table. Added "uniqueness" to one of the columns. Completed.
Then I wanted to remove unique from the column, but that was not the case. It gives me an error when running:
1f8ca43f7453424ea8785b825cc2d803.png

How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2016-05-19
@hummingbird

ALTER TABLE "some_table" DROP CONSTRAINT "unique_somefield";

The constraint name can be obtained by query
SELECT *
FROM information_schema.constraint_table_usage
WHERE table_name = 'some_table';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question