In my PostgreSQL database I have a unique index created this way:
CREATE UNIQUE INDEX ON USING btree (my_column)
Searched for hours for the same quesiton and doesnt seem to get a right answer---- all the given answers just failed to work.
For not null, it also took me some time to find. Apparently for some reason, the majority-certified codes just dont work when I use it.
I got the not null version code, something like this
ALTER TABLE tablename
ALTER COLUMN column_want_to_remove_constriant
DROP NOT NULL
Sadly changing 'not null' to 'unique' doesnt work.