无法创建没有超级用户角色的扩展 [英] cannot create extension without superuser role
问题描述
但是,当我运行测试时,它会给我以下错误:
$ ./manage.py test
为别名默认创建测试数据库...
创建测试数据库时出错:数据库test_project已经存在
如果要尝试删除测试数据库test_project或否取消,请输入yes:yes
销毁旧的测试数据库'default'...
DatabaseError:权限被拒绝创建扩展名postgis
提示:必须是超级用户才能创建此扩展名。
用户已经有Create DB权限,我在Ubuntu 12.04上使用PostgisSQL 9.1与Postgis 2.0
关于postgis的Django文档有一些关于设置用户权限的信息。
在最糟糕的情况下,你可以创建一个新的超级用户:
$ createuser --superuser< user_name>
或更改现有用户的角色:
postgres#ALTER ROLE< user_name> SUPERUSER;
I'm trying to run unit tests in Django, and it creates a new database. The database has postgis extensions and when I regularly create the database, I use "CREATE ExTENSION postgis".
However, when I run tests, it gives me the following error:
$ ./manage.py test
Creating test database for alias 'default'...
Got an error creating the test database: database "test_project" already exists
Type 'yes' if you would like to try deleting the test database 'test_project', or 'no' to cancel: yes
Destroying old test database 'default'...
DatabaseError: permission denied to create extension "postgis"
HINT: Must be superuser to create this extension.
The user has the Create DB privilege already, I'm using PostgreSQL 9.1 on Ubuntu 12.04 with Postgis 2.0.
The Django documentation on postgis has some information on setting up user privileges.
In the worst case you can create a new superuser:
$ createuser --superuser <user_name>
or alter an existing user's role:
postgres# ALTER ROLE <user_name> SUPERUSER;
这篇关于无法创建没有超级用户角色的扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!