【问题标题】:Renaming index yields "Error: cross-database references are not implemented"重命名索引产生“错误:未实现跨数据库引用”
【发布时间】:2020-07-15 10:08:18
【问题描述】:

我在schemaName 内的表tableName 上有一个索引badName,如下创建:

CREATE UNIQUE INDEX badName ON schemaName.tableName USING btree;

现在我想将索引重命名为goodName。这是我的尝试:

ALTER INDEX schemaName.tableName.badName RENAME TO goodName;

结果:

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

我正在使用 postgresql 数据库,但想使用原生 SQL 查询。

【问题讨论】:

    标签: sql postgresql indexing


    【解决方案1】:

    您需要(仅)指定索引名称,而不是表名称:

    ALTER INDEX schemaname.badname RENAME TO goodname;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-17
      • 2019-01-09
      • 2019-08-18
      • 2017-02-08
      • 1970-01-01
      • 1970-01-01
      • 2023-01-30
      • 1970-01-01
      相关资源
      最近更新 更多