【问题标题】:Can't drop an index in postgres Heroku - receive ERROR: index "ix_public_jobs_next_run_time" does not exist无法在 postgres Heroku 中删除索引 - 收到错误:索引“ix_public_jobs_next_run_time”不存在
【发布时间】:2020-06-26 16:22:31
【问题描述】:

我在 Heroku Postgres(爱好层)中有一张带有“工作”表的表。我正在使用 PGAdmin 来查看和使用数据库。

如果我查看“jobs”表的从属选项卡,我可以看到存在一个索引“public.ix_public_jobs_next_run_time”。

从查询工具中,我运行查询“DROP INDEX public.ix_public_jobs_next_run_time;”并得到以下错误:

错误:索引“ix_public_jobs_next_run_time”不存在 SQL 状态:42704

为什么我不能删除这个索引?

背景:我正在使用 SQLAlchemy ORM 对我的 postgres 数据库进行 db 升级以修改一些表。 db upgrade 命令在尝试删除索引时失败。我使用上述步骤重新创建了这个错误。

【问题讨论】:

  • SELECT quote_ident(relname) FROM pg_class WHERE relname LIKE '%next%' AND relkind = 'i' ; 能得到什么?
  • 返回:ix_public_jobs_next_run_time

标签: postgresql heroku indexing drop


【解决方案1】:

也许您设置了一个不包括publicsearch_path。然后你必须明确命名模式:

DROP INDEX public.ix_public_jobs_next_run_time;

当然,另一种选择是在尝试删除索引时连接到错误的数据库。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-31
    • 1970-01-01
    • 2016-11-05
    • 2015-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-03
    相关资源
    最近更新 更多