On my postgres database, I have some tables that were created on the wrong schema ("ag_catalog"
) and I decided to drop it anyway since it was just for testing. I had also installed the age
extension, but then I dropped it with DROP EXTENSION age;
. When I tried dropping the "ag_catalog" schema, the terminal showed the following error:
demo=# DROP SCHEMA ag_catalog CASCADE;
NOTICE: drop cascades to 3 other objects
DETAIL: drop cascades to table polls
drop cascades to table options
drop cascades to table votes
ERROR: table "ag_label" does not exist
I tried creating the extension again and executing the same command to drop the schema, but now it shows another error:
demo=# DROP SCHEMA ag_catalog CASCADE;
NOTICE: drop cascades to 4 other objects
DETAIL: drop cascades to table polls
drop cascades to table options
drop cascades to table votes
drop cascades to extension age
ERROR: index "ag_label_relation_index" does not exist
2
Answers
There are errors occuring when you try to access and operate on the
ag
tables directly. I recommend you delete the extension library from postgres probably in the/usr/local/<enter_postgres_directory>/lib/
and delete theage.so
file and try again.If that doesn’t work you (and you don’t have any valuable data) you can delete the
initdb
file and initializing the database again.Worst case reinstall postgres and the extension.
Execute this command in the Apache AGE local directory:
Then, you have two options: either try dropping the schema again or delete age.so in the Postgres lib directory and then drop the schema.
Another possibility is to restore the database. Please follow the steps outlined on here to do so.