简体   繁体   中英

Renaming index yields “Error: cross-database references are not implemented”

I have an index badName on table tableName inside schemaName , created like so:

CREATE UNIQUE INDEX badName ON schemaName.tableName USING btree;

Now I want to rename the index to goodName . This is my attempt at it:

ALTER INDEX schemaName.tableName.badName RENAME TO goodName;

Which results in:

Error [0A000] cross-database references are not implemented

I am using postgresql database, but want to use native SQL query.

You need to specify (only) the index name, not the table name:

ALTER INDEX schemaname.badname RENAME TO goodname;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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