psql必须是扩展名plpgsql的所有者

问题描述 投票:0回答:1

Ubuntu 18.04,Ruby ruby​​ 2.4.1p111(2017-03-22修订版58053)[x86_64-linux],PostgreSQL 9.4.21

我正在尝试为db create运行rake,这是我得到的:

nenad@mycomputer-l:~/someproject/foo$ bundle exec rake db:create db:bar:create db:prepare
**************************************************
⛔️ WARNING: Sidekiq testing API enabled, but this is not the test environment.  Your jobs will not go to Redis.
**************************************************
Database 'foo_development' already exists
Database 'foo_test' already exists
Database 'bar-development' already exists
Database 'bar-test' already exists
 set_config 
------------

(1 row)

psql:/home/nenad/someproject/foo/db/structure.sql:20: ERROR:  must be owner of extension plpgsql
rake aborted!
failed to execute:
psql -v ON_ERROR_STOP=1 -q -f /home/nenad/someproject/foo/db/structure.sql foo_development

Please check the output above for any errors and make sure that `psql` is installed in your PATH and has proper permissions.

/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/postgresql_database_tasks.rb:116:in `run_cmd'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/postgresql_database_tasks.rb:88:in `structure_load'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:234:in `structure_load'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:247:in `load_schema'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:266:in `block in load_schema_current'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:313:in `each'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:265:in `load_schema_current'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:300:in `block (3 levels) in <top (required)>'
/home/nenad/someproject/foo/lib/tasks/db.rake:5:in `block (2 levels) in <top (required)>'
/home/nenad/someproject/foo/vendor/bundle/ruby/2.4.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/home/nenad/.rbenv/versions/2.4.1/bin/bundle:22:in `load'
/home/nenad/.rbenv/versions/2.4.1/bin/bundle:22:in `<main>'
Tasks: TOP => db:structure:load
(See full trace by running task with --trace)
ruby postgresql-9.4 ubuntu-18.04
1个回答
1
投票

您可能需要在psql中更改权限。

尝试以postgres身份登录

sudo -u postgres psql

用户然后列出您的数据库和相关用户

\du

然后

alter role <your_role_name> superuser;

© www.soinside.com 2019 - 2024. All rights reserved.