ruby - psql 必须是扩展 plpgsql 的所有者

标签 ruby postgresql-9.4 ubuntu-18.04

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)

最佳答案

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

尝试以 postgres 身份登录

sudo -u postgres psql

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

\du

然后

alter role <your_role_name> superuser;

关于ruby - psql 必须是扩展 plpgsql 的所有者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54946156/

相关文章:

ruby - Ruby 中的堆栈级别太深,试图随机抽取一张卡片

postgresql - Postgres 文本列只允许/转换为小写并且没有特殊字符,例如 : Ñöáè

ruby-on-rails - Rails 如何创建 cookie 并稍后调用数据?

ruby - 如何将 Ruby 连接到 Postgresql?

postgresql - psql中set、\set和\pset的区别

json - 如何合并两个 JSON 数组中的记录?

postgresql - WSL 中的 Odoo 12 - Psycopg2 没有为 PostgreSQL 获得正确的端口

ubuntu - modprobe uio_pci_genericco 在 Ubuntu 18.04.6 上失败

python-3.x - Ubuntu 18.04 LTS 上的 Hyperledger Sawtooth 安装问题

ruby-on-rails - Rails 4 View 渲染非常慢