Home > OS >  How to fix cache lookup failure/corrupted database?
How to fix cache lookup failure/corrupted database?

Time:03-14

I've got a postgres database that I'm trying to clean up with drop schema public cascade. The data on it is not that important and I never made any backups. I'm just trying to rebuild it. However, it seems an error I made earlier is causing the drop command to fail. When I run drop schema public cascade, I get a ERROR: cache lookup failed for constraint XXXXX. I checked pg_constraints and it doesn't exist. It's probably linked to a table/index that doesn't exist anymore. Is there anyway I can get rid of this persisting/non-existing constraint so I can cleanup the database?

CodePudding user response:

Perhaps it is enough to remove the dependency:

DELETE FROM pg_depend
WHERE objid = XXXXX;
  • Related