簡體   English   中英

ActiveRecord::StatementInvalid (PG::InsufficientPrivilege: ERROR: permission denied for relationship

[英]ActiveRecord::StatementInvalid (PG::InsufficientPrivilege: ERROR: permission denied for relation

當我 rake db:migrate 我得到這個錯誤

2020-06-25T19:43:57.952516+00:00 app[web.1]: Started GET "/assets/application.js" for 76.69.13.178 at 2020-06-25 19:43:57 +0000
2020-06-25T19:43:57.968675+00:00 app[web.1]: Started GET "/animate.min.css" for 76.69.13.178 at 2020-06-25 19:43:57 +0000
2020-06-25T19:43:57.971906+00:00 app[web.1]: 
2020-06-25T19:43:57.971908+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/animate.min.css"):
2020-06-25T19:43:57.971920+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2020-06-25T19:43:57.971924+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2020-06-25T19:43:57.971925+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:38:in `call_app'
2020-06-25T19:43:57.971925+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:20:in `block in call'
2020-06-25T19:43:57.971925+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2020-06-25T19:43:57.971925+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:26:in `tagged'
2020-06-25T19:43:57.971926+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `tagged'
2020-06-25T19:43:57.971926+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:20:in `call'
2020-06-25T19:43:57.971926+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2020-06-25T19:43:57.971926+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/methodoverride.rb:22:in `call'
2020-06-25T19:43:57.971927+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/runtime.rb:18:in `call'
2020-06-25T19:43:57.971927+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2020-06-25T19:43:57.971927+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/static.rb:120:in `call'
2020-06-25T19:43:57.971928+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/sendfile.rb:113:in `call'
2020-06-25T19:43:57.971928+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/engine.rb:518:in `call'
2020-06-25T19:43:57.971928+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/application.rb:165:in `call'
2020-06-25T19:43:57.971929+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/lock.rb:17:in `call'
2020-06-25T19:43:57.971929+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/content_length.rb:15:in `call'
2020-06-25T19:43:57.971929+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/handler/webrick.rb:88:in `service'
2020-06-25T19:43:57.971930+00:00 app[web.1]: vendor/ruby-2.4.6/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service'
2020-06-25T19:43:57.971930+00:00 app[web.1]: vendor/ruby-2.4.6/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run'
2020-06-25T19:43:57.971930+00:00 app[web.1]: vendor/ruby-2.4.6/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
2020-06-25T19:43:57.971930+00:00 app[web.1]: 
2020-06-25T19:43:57.971931+00:00 app[web.1]: 
2020-06-25T19:43:57.978276+00:00 app[web.1]: Started GET "/assets/application.css" for 76.69.13.178 at 2020-06-25 19:43:57 +0000
2020-06-25T19:43:57.991055+00:00 app[web.1]: Started GET "/css/style.css" for 76.69.13.178 at 2020-06-25 19:43:57 +0000
2020-06-25T19:43:58.000043+00:00 app[web.1]: 
2020-06-25T19:43:58.000047+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/css/style.css"):
2020-06-25T19:43:58.000048+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2020-06-25T19:43:58.000049+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2020-06-25T19:43:58.000050+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:38:in `call_app'
2020-06-25T19:43:58.000050+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:20:in `block in call'
2020-06-25T19:43:58.000050+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2020-06-25T19:43:58.000051+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:26:in `tagged'
2020-06-25T19:43:58.000051+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `tagged'
2020-06-25T19:43:58.000052+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/rack/logger.rb:20:in `call'
2020-06-25T19:43:58.000052+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2020-06-25T19:43:58.000053+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/methodoverride.rb:22:in `call'
2020-06-25T19:43:58.000053+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/runtime.rb:18:in `call'
2020-06-25T19:43:58.000054+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2020-06-25T19:43:58.000054+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/static.rb:120:in `call'
2020-06-25T19:43:58.000055+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/sendfile.rb:113:in `call'
2020-06-25T19:43:58.000055+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/engine.rb:518:in `call'
2020-06-25T19:43:58.000055+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/application.rb:165:in `call'
2020-06-25T19:43:58.000056+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/lock.rb:17:in `call'
2020-06-25T19:43:58.000056+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/content_length.rb:15:in `call'
2020-06-25T19:43:58.000056+00:00 app[web.1]: vendor/bundle/ruby/2.4.0/gems/rack-1.6.13/lib/rack/handler/webrick.rb:88:in `service'
2020-06-25T19:43:58.000057+00:00 app[web.1]: vendor/ruby-2.4.6/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service'
2020-06-25T19:43:58.000057+00:00 app[web.1]: vendor/ruby-2.4.6/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run'
2020-06-25T19:43:58.000057+00:00 app[web.1]: vendor/ruby-2.4.6/lib/ruby/2.4.0/webrick/server.rb:308:in `block in start_thread'
2020-06-25T19:43:58.000057+00:00 app[web.1]: 
2020-06-25T19:43:58.000058+00:00 app[web.1]: 
2020-06-25T19:43:58.022616+00:00 app[web.1]: Started GET "/assets/pa.png" for 76.69.13.178 at 2020-06-25 19:43:58 +0000
2020-06-25T19:43:58.106788+00:00 app[web.1]: Started GET "/assets/bootstrap/glyphicons-halflings-regular.woff2" for 76.69.13.178 at 2020-06-25 19:43:58 +0000
2020-06-25T19:43:58.030079+00:00 heroku[router]: at=info method=GET path="/assets/pa.png" host=www.petraauto.com request_id=25796113-5929-438b-b481-615e8d8b33a1 fwd="76.69.13.178" dyno=web.1 connect=1ms service=9ms status=304 bytes=343 protocol=http
2020-06-25T19:43:58.131616+00:00 heroku[router]: at=info method=GET path="/assets/bootstrap/glyphicons-halflings-regular.woff2" host=www.petraauto.com request_id=a6fdbf59-862e-4b51-8896-15729bfa02cb fwd="76.69.13.178" dyno=web.1 connect=0ms service=29ms status=304 bytes=343 protocol=http
2020-06-25T19:43:58.002350+00:00 heroku[router]: at=info method=GET path="/css/style.css" host=www.petraauto.com request_id=eb2d1107-cf2b-44e4-87e2-4a3c2285508b fwd="76.69.13.178" dyno=web.1 connect=1ms service=87ms status=404 bytes=1832 protocol=http
2020-06-25T19:46:27.739009+00:00 app[web.1]: Started GET "/cars/442" for 54.36.148.156 at 2020-06-25 19:46:27 +0000
2020-06-25T19:46:27.745747+00:00 app[web.1]: Processing by CarsController#show as */*
2020-06-25T19:46:27.745819+00:00 app[web.1]: Parameters: {"id"=>"442"}
2020-06-25T19:46:27.759854+00:00 app[web.1]: Completed 404 Not Found in 14ms (ActiveRecord: 5.8ms)
2020-06-25T19:46:27.777150+00:00 app[web.1]: 
2020-06-25T19:46:27.777153+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Car with 'id'=442):
2020-06-25T19:46:27.777154+00:00 app[web.1]: app/controllers/cars_controller.rb:90:in `find_car'
2020-06-25T19:46:27.777154+00:00 app[web.1]: 
2020-06-25T19:46:27.777155+00:00 app[web.1]: 
2020-06-25T19:46:27.784351+00:00 heroku[router]: at=info method=GET path="/cars/442" host=www.petraauto.com request_id=c6b2c8bd-b5b8-4964-9b86-b297f571ac14 fwd="54.36.148.156" dyno=web.1 connect=1ms service=49ms status=404 bytes=1832 protocol=https
2020-06-25T19:48:10.413036+00:00 heroku[router]: at=info method=GET path="/robots.txt" host=www.petraauto.com request_id=d9d8f65c-b693-41ce-b45b-53f8ad0fe38a fwd="46.229.168.144" dyno=web.1 connect=1ms service=10ms status=200 bytes=418 protocol=http
2020-06-25T19:48:10.673719+00:00 heroku[router]: at=info method=GET path="/?visit_web_site_nonce=7ba4507588" host=www.petraauto.com request_id=eac73faf-0a08-4c84-9e66-ec7f67a8dfe7 fwd="46.229.168.133" dyno=web.1 connect=1ms service=27ms status=200 bytes=7116 protocol=http
2020-06-25T19:48:10.650301+00:00 app[web.1]: Started GET "/?visit_web_site_nonce=7ba4507588" for 46.229.168.133 at 2020-06-25 19:48:10 +0000
2020-06-25T19:48:10.655679+00:00 app[web.1]: Processing by WelcomeController#index as HTML
2020-06-25T19:48:10.655718+00:00 app[web.1]: Parameters: {"visit_web_site_nonce"=>"7ba4507588"}
2020-06-25T19:48:10.663511+00:00 app[web.1]: Rendered welcome/index.html.erb within layouts/application (5.6ms)
2020-06-25T19:48:10.666713+00:00 app[web.1]: Completed 200 OK in 11ms (Views: 10.3ms | ActiveRecord: 0.0ms)
2020-06-25T19:49:05.196733+00:00 app[web.1]: Started POST "/cars" for 96.49.253.124 at 2020-06-25 19:49:05 +0000
2020-06-25T19:49:05.198982+00:00 app[web.1]: Processing by CarsController#create as HTML
2020-06-25T19:49:05.199098+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"gGEb8B0qPs+mn8Vfr0Oqtub0PqaBmIib1v749hIOdxXUMoyuQh5kDo+D3PpqURWLlPT64PpIcV5e8KnPqgBvBw==", "car"=>{"name"=>"qwdsfgv", "image2"=>#<ActionDispatch::Http::UploadedFile:0x00007f84dda07ee0 @tempfile=#<Tempfile:/tmp/RackMultipart20200625-4-1yupza3.jpeg>, @original_filename="images.jpeg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"car[image2]\"; filename=\"images.jpeg\"\r\nContent-Type: image/jpeg\r\n">, "description"=>"", "price"=>"", "speed"=>"", "status"=>"", "available_ids"=>["1", ""]}, "commit"=>"Save"}
2020-06-25T19:49:05.204310+00:00 app[web.1]: [paperclip] Trying to link /tmp/RackMultipart20200625-4-1yupza3.jpeg to /tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg
2020-06-25T19:49:05.205406+00:00 app[web.1]: [paperclip] Trying to link /tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg to /tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-jin43v.jpeg
2020-06-25T19:49:05.205760+00:00 app[web.1]: Command :: file -b --mime '/tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-jin43v.jpeg'
2020-06-25T19:49:05.210250+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg[0]' 2>/dev/null
2020-06-25T19:49:05.407267+00:00 app[web.1]: Command :: identify -format %m '/tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg[0]'
2020-06-25T19:49:05.414387+00:00 app[web.1]: Command :: convert '/tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg[0]' -auto-orient -resize "300x300>" '/tmp/1825a9080f8543b228dfb963aa92960720200625-4-1gwjql3'
2020-06-25T19:49:05.424569+00:00 app[web.1]: [paperclip] Trying to link /tmp/1825a9080f8543b228dfb963aa92960720200625-4-1gwjql3 to /tmp/abbf3c45a8db8f2bf35789604ac0f7a720200625-4-fx1ptg
2020-06-25T19:49:05.425377+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg[0]' 2>/dev/null
2020-06-25T19:49:05.437324+00:00 app[web.1]: Command :: identify -format %m '/tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg[0]'
2020-06-25T19:49:05.444596+00:00 app[web.1]: Command :: convert '/tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg[0]' -auto-orient -resize "100x100>" '/tmp/1825a9080f8543b228dfb963aa92960720200625-4-26995n'
2020-06-25T19:49:05.484946+00:00 app[web.1]: [paperclip] Trying to link /tmp/1825a9080f8543b228dfb963aa92960720200625-4-26995n to /tmp/16ed0fb48751e7972f9fa6cb2c6a68b620200625-4-qen9dz
2020-06-25T19:49:05.494152+00:00 app[web.1]: [paperclip] Trying to link /tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1mtpx0e.jpeg to /tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1btfcwn.jpeg
2020-06-25T19:49:05.494433+00:00 app[web.1]: Command :: file -b --mime '/tmp/59b514174bffe4ae402b3d63aad79fe020200625-4-1btfcwn.jpeg'
2020-06-25T19:49:05.506080+00:00 app[web.1]: Completed 500 Internal Server Error in 307ms (ActiveRecord: 9.7ms)
2020-06-25T19:49:05.507593+00:00 app[web.1]: 
2020-06-25T19:49:05.507594+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::InsufficientPrivilege: ERROR:  permission denied for relation cars
2020-06-25T19:49:05.507595+00:00 app[web.1]: : INSERT INTO "cars" ("name", "description", "speed", "status", "image2_file_name", "image2_content_type", "image2_file_size", "image2_updated_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id"):
2020-06-25T19:49:05.507596+00:00 app[web.1]: app/controllers/cars_controller.rb:39:in `create'
2020-06-25T19:49:05.507596+00:00 app[web.1]: 
2020-06-25T19:49:05.507597+00:00 app[web.1]: 
2020-06-25T19:49:05.510409+00:00 heroku[router]: at=info method=POST path="/cars" host=www.petraauto.com request_id=272a6dd9-263a-4140-b5f9-9e5b823d2a80 fwd="96.49.253.124" dyno=web.1 connect=1ms service=497ms status=500 bytes=1754 protocol=http
2020-06-25T19:49:05.689859+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=www.petraauto.com request_id=74324238-1c03-4f9c-a8a7-97726cd00908 fwd="96.49.253.124" dyno=web.1 connect=0ms service=3ms status=200 bytes=7606 protocol=http
2020-06-25T19:52:14.758752+00:00 heroku[router]: at=info method=GET path="/robots.txt" host=www.petraauto.com request_id=41d3da77-6510-4aec-9860-8590b33262a2 fwd="10.179.4.24,114.119.162.11" dyno=web.1 connect=1ms service=4ms status=200 bytes=418 protocol=http

我試圖在這里查找答案,但沒有解決我的問題。

$ heroku pg:info
=== DATABASE_URL, HEROKU_POSTGRESQL_IVORY_URL
Plan:                  Hobby-dev
Status:                Available
Connections:           1/20
PG Version:            9.6.18
Created:               2015-01-30 17:15 UTC
Data Size:             16.1 MB
Tables:                9
Rows:                  11578/10000 (Write access revoked)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                flying-fairly-7818

=== HEROKU_POSTGRESQL_GREEN_URL
Plan:                  Hobby-dev
Status:                Available
Connections:           0/20
PG Version:            11.8
Created:               2019-10-08 05:58 UTC
Data Size:             7.7 MB
Tables:                0
Rows:                  0/10000 (In compliance)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-metric-03249

=== HEROKU_POSTGRESQL_VIOLET_URL
Plan:                  Hobby-dev
Status:                Available
Connections:           0/20
PG Version:            11.8
Created:               2015-06-05 20:14 UTC
Data Size:             8.6 MB
Tables:                9
Rows:                  87/10000 (In compliance)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                blooming-keenly-3369
 $ heroku pg:info === DATABASE_URL, HEROKU_POSTGRESQL_IVORY_URL Plan: Hobby-dev... Data Size: 16.1 MB Tables: 9 Rows: 11578/10000 (Write access revoked)...

是什么導致了 PG::InsufficientPrivilege 錯誤。 您正在使用 Hobby-dev 計划,該計划將您的數據庫中的行數限制為 10,000 行。 您當前有 11,578 行,它已暫時暫停您的寫入權限。

根據Heroku 文檔

如果 7 天后行數仍然超過計划容量,則撤銷數據庫的 INSERT 權限。 仍然可以從數據庫中讀取、更新或刪除數據。 這確保了用戶可以使他們的數據庫合規並保留對其數據的訪問權限。

當您接近極限時,您實際上應該收到警告 email。 如果您清除數據庫中的一些數據,它將自動恢復寫入權限。 Hobby-basic 計划(不是免費的)將您的行數限制提高到 1000 萬行,所以這也是一種選擇。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM