admin管理员组文章数量:1327750
I am new to Postgres and am having an issue dropping all tables in a database. I have a database named "mvp" and the owner is set as "postgres." I did the following in my terminal:
psql -d mvp postgres -W
postgres=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+---------------------
mvp | postgres | UTF8 | C | C |
postgres=> \c mvp
You are now connected to database "mvp" as user "postgres".
mvp=> DROP SCHEMA public CASCADE;
ERROR: must be owner of schema public
It is showing that I am logged in as the user "postgres" which happens to be the owner of the "mvp" database. However, I am receiving an error message saying I am not the owner.
I am new to Postgres and am having an issue dropping all tables in a database. I have a database named "mvp" and the owner is set as "postgres." I did the following in my terminal:
psql -d mvp postgres -W
postgres=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+---------------------
mvp | postgres | UTF8 | C | C |
postgres=> \c mvp
You are now connected to database "mvp" as user "postgres".
mvp=> DROP SCHEMA public CASCADE;
ERROR: must be owner of schema public
It is showing that I am logged in as the user "postgres" which happens to be the owner of the "mvp" database. However, I am receiving an error message saying I am not the owner.
Share Improve this question asked Feb 18, 2023 at 19:20 kirasam72kirasam72 1652 silver badges10 bronze badges 2-
1
To your question add the answers to the following mands run in
psql
1) select version(); 2)\du postgres
3)\dn public
– Adrian Klaver Commented Feb 18, 2023 at 21:53 -
The
\l
does confirm that postgres is the owner of the database. However, the error messages says that postgres is not the owner of the schema. – Bergi Commented Feb 19, 2023 at 1:36
1 Answer
Reset to default 5Unless you have changed the ownership of schema public
before, postgres
(the owner of the database) would be the owner of that schema. So you'd have to connect as user postgres
or a superuser to drop the schema.
To approach that methodically:
find out who owns schema
public
\dn public
bee that user
\c - username
drop the schema
DROP SCHEMA public CASCADE;
本文标签: javascriptPostgreSQL ERROR must be owner of schema publicStack Overflow
版权声明:本文标题:javascript - PostgreSQL ERROR: must be owner of schema public - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742229028a2436871.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论