In postgres how do I add index to existing table?

半腔热情 提交于 2019-12-25 18:56:15

问题


In postgres how do I add index to existing table?

I tried following but it's not working:

CREATE INDEX my_index ON my_table USING btree(a_column);

and then this:

CREATE INDEX my_index ON my_table USING btree(a_column);

But neither works.

I am using ant to do a db migration. And when I do ant db-migrate-apply-postgresql I keep getting the error

 [echo] ERROR:  relation "my_index" already exists

回答1:


Well, this error message:

ERROR: relation "my_index" already exists

is pretty clear, isn't it.

You are trying to create an index with the name of an existing index or table. You need to use a different name.



来源:https://stackoverflow.com/questions/11353347/in-postgres-how-do-i-add-index-to-existing-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!