In a postgres database, I have a unique constraint and two unique indexes created for the same. I deleted the constraint using the query below:
alter table my_schema.users drop constraint users_dept_uk
It has dropped the constraint and one index but there was a second index which still exists.
The follwoing query is still telling me the index exists:
SELECT r.relname, r.relkind, n.nspname
FROM pg_class r INNER JOIN pg_namespace n ON r.relnamespace = n.oid
WHERE r.relname = 'users_dept_idx';
It gives the following output:
users_dept_idx, i, my_schema
When I execute the query below:
drop index my_schema.users_dept_idx
I am getting the error:
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedObject) index "users_dept_idx" does not exist
What am I missing here? Not able to delete it and not able to insert data because of this index which I no longer want.