简体   繁体   English

PostgreSQL 删除唯一索引

[英]PostgreSQL Drop Unique Index

I have this statement in Postgres to create a unique index: CREATE UNIQUE INDEX CONCURRENTLY organization_user_ux1 ON organization_user (organization_id,user_id);我在 Postgres 中有这条语句来创建一个唯一索引: CREATE UNIQUE INDEX CONCURRENTLY organization_user_ux1 ON organization_user (organization_id,user_id);

... I need to drop this unique index, so I tried: ...我需要删除这个唯一索引,所以我尝试了:

ALTER TABLE public.organization_user DROP INDEX organization_user_ux1; ALTER TABLE public.organization_user DROP INDEX organization_user_ux1;

and recieved error: ERROR: syntax error at or near "organization_user_ux1" using flyway to execute these scripts.并收到错误:错误:使用 flyway 执行这些脚本的“organization_user_ux1”处或附近出现语法错误。

How do I correctly undo this concurrent unique index?如何正确撤消此并发唯一索引?

Read This documentation for your reference Drop Index阅读此文档以供参考Drop Index

IN your case:在你的情况下:

DROP INDEX organization_user_ux1

or if you want it concurrently或者如果你同时想要它

DROP INDEX CONCURRENTLY organization_user_ux1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM