Remove uniqueness of index in PostgreSQL

后端 未结 5 1311
南笙
南笙 2021-01-31 06:56

In my PostgreSQL database I have a unique index created this way:

CREATE UNIQUE INDEX  ON  USING btree (my_column)
5条回答
  •  花落未央
    2021-01-31 07:51

    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.

提交回复
热议问题