I encountered the error 'ERROR: Catalog error: cannot drop database db2 because schema public depend on it' in a Docker image. Pin Zhang suggested dropping the schema 'public' before dropping the database. However, after dropping the schema, normal CREATE TABLE functions cannot be used. How can I resolve this error in Docker image?
jie
Asked on Jun 22, 2022
To resolve the error 'ERROR: Catalog error: cannot drop database db2 because schema public depend on it' in a Docker image, you should drop the schema 'public' before dropping the database.
If normal CREATE TABLE functions cannot be used after dropping the schema, ensure you are connected to the correct database.
When creating a table without specifying a schema, 'public' will be the default one. Make sure to switch to the correct database using the command '\c dbname;' before performing any operations.