user13820256
user13820256

Reputation: 11

Can't drop an index in postgres Heroku - receive ERROR: index "ix_public_jobs_next_run_time" does not exist

I have a table in Heroku Postgres (Hobby tier) with a "jobs" table. I am using PGAdmin to view and work with the database.

If I view the dependents tab for the "jobs" table, I can see that an index exists "public.ix_public_jobs_next_run_time".

From the query tool, I run the query "DROP INDEX public.ix_public_jobs_next_run_time;" and get the following error:

ERROR: index "ix_public_jobs_next_run_time" does not exist SQL state: 42704

Why can't I drop this index?

Background: I am using SQLAlchemy ORM to db upgrade my postgres database to modify some tables. The db upgrade command fails when it tries to drop the index. I used the steps above to recreate this error.

Upvotes: 1

Views: 896

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247410

Perhaps you set a search_path that does not include public. Then you have to name the schema explicitly:

DROP INDEX public.ix_public_jobs_next_run_time;

Another option is of course that you connected to the wrong database when you tried to drop the index.

Upvotes: 0

Related Questions