-1

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
Matheus Farias
  • 716
  • 1
  • 10

3 Answers3

0

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 the age.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.

0

Execute this command in the Apache AGE local directory:

sudo make PG_CONFIG=/path_to_postgres/bin/pg_config clean

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.

Wendel
  • 763
  • 1
  • 12
0

As far as I know, you are facing the error due to the dependent objects. So you first need to check for the dependent objects using this query:

SELECT * FROM pg_depend WHERE refobjid = 'ag_catalog'::regclass;

After this, you have to use DROP TABLE and DROP INDEX commands for dropping tables and indexes.

After this you have to go for schema dropping step using this command:

DROP SCHEMA ag_catalog CASCADE;
adil shahid
  • 125
  • 4