cannot create extension without superuser role

前端 未结 6 1436
孤街浪徒
孤街浪徒 2020-12-23 11:12

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 ExTENSIO

6条回答
  •  执笔经年
    2020-12-23 12:07

    A safe way to do this without delegating superuser privileges would be to access the database in which we are executing the query with a user with a superuser role such as postgres.

    $ sudo -u postgres psql 
    
    #= CREATE EXTENSION IF NOT EXISTS ;
    

    This way you don't expose security and you can believe the extension in the db.

    GL

提交回复
热议问题