fix read-only access if the db is read-only
fix read-only access if the db is read-only

postgres only.

test plan:
 * change your database.yml to use a user that doesn't have update
   permissions
 * *don't* use db for pageviews
 * *do* use encrypted cookie store as a session store (i.e. not
   the db)
 * you should be able to login and click around, but any action that
   will require a write to the db should give an error
 * rinse and repeat, but this time use a normal error against a
   database that's in recovery

Change-Id: I7da86316f69f354f3ba55a1e5335b35846396277
Reviewed-on: https://gerrit.instructure.com/14763
Tested-by: Jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@instructure.com>
Reviewed-by: Brian Palmer <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@instructure.com>

greyhwndz/canvas-lms,greyhwndz/canvas-lms,leftplusrightllc/canvas-lms,samuels410/greatlakes-lms,landonwilkins/canvas-lms,Unow/ins,venturehive/canvas-lms,antoniuslin/canvas-lms,landonwilkins/canvas-lms,utkarshx/canvas-lms,landonwilkins/canvas-lms,loganrun/pincan,nditech/red-innovadores-lms,usmschuck/canvas,shidao-fm/canvas-lms,tgroshon/canvas-lms,fronteerio/canvas-lms,grahamb/canvas-lms,arrivu/qibla-ecampus,va7map/canvas-lms,leftplusrightllc/canvas-lms,whalejasmine/canvas-lms,wimemx/Canvas,arrivu/arrivu-lms,Unow/canvas-lms,arrivu/hoodemo,nditech/red-innovadores-lms,va7map/canvas-lms,arrivu/qibla-ecampus,arrivu/jigsaw-lms,kyroskoh/canvas-lms,parbros/red-innovadores-lms,Jyaasa/canvas-lms,sli7246/canvas_branch,fronteerio/canvas-lms,juoni/canvas-lms,kyroskoh/canvas-lms,sli7246/canvas_branch,merichar/canvas-lms,HotChalk/canvas-lms,usmschuck/canvas,SwinburneOnline/canvas-lms,ShreniiNepal/shrenii_lmp,rup/Tarrax,utkarshx/canvas-lms,juoni/canvas-lms,sfu/canvas-lms,arrivu/qibla-ecampus,djbender/canvas-lms,HotChalk/canvas-lms,Unow/ins,wrdsb/canvas-lms,usmschuck/canvas,wye0220/shindig-canvas,Rvor/canvas-lms,merichar/canvas-lms,grahamb/canvas-lms,sli7246/canvas_branch,efrj/canvas-lms,parbros/red-innovadores-lms,sdeleon28/canvas-lms,djbender/canvas-lms,Jyaasa/canvas-lms,loganrun/pincan,roxolan/canvas-lms,wrdsb/canvas-lms,samuels410/greatlakes-lms,arrivu/jigsaw-lms,nditech/red-innovadores-lms,ShreniiNepal/shrenii_lmp,leftplusrightllc/canvas-lms,shidao-fm/canvas-lms,sdeleon28/canvas-lms,samuels410/greatlakes-lms,wye0220/shindig-canvas,fronteerio/canvas-lms,nditech/red-innovadores-lms,merichar/canvas-lms,grahamb/canvas-lms,shidao-fm/canvas-lms,ShreniiNepal/shrenii_lmp,redconfetti/canvas-lms,SwinburneOnline/canvas-lms,HotChalk/canvas-lms,skmezanul/canvas-lms,djbender/canvas-lms,SwinburneOnline/canvas-lms,loganrun/pincan,roxolan/canvas-lms,va7map/canvas-lms,whalejasmine/canvas-lms,jay3126/canvas-lms,skmezanul/canvas-lms,djbender/canvas-lms,tgroshon/canvas-lms,tgroshon/canvas-lms,kyroskoh/canvas-lms,sfu/canvas-lms,usmschuck/canvas,sfu/canvas-lms,arrivu/jigsaw-lms,venturehive/canvas-lms,Unow/ins,arrivu/hoodemo,shidao-fm/canvas-lms,whalejasmine/canvas-lms,jay3126/canvas-lms,skmezanul/canvas-lms,venturehive/canvas-lms,skmezanul/canvas-lms,arrivu/hoodemo,sfu/canvas-lms,wrdsb/canvas-lms,sdeleon28/canvas-lms,greyhwndz/canvas-lms,Rvor/canvas-lms,roxolan/canvas-lms,redconfetti/canvas-lms,juoni/canvas-lms,leftplusrightllc/canvas-lms,wye0220/shindig-canvas,samuels410/greatlakes-lms,Rvor/canvas-lms,fronteerio/canvas-lms,va7map/canvas-lms,parbros/red-innovadores-lms,redconfetti/canvas-lms,redconfetti/canvas-lms,sdeleon28/canvas-lms,wimemx/Canvas,efrj/canvas-lms,roxolan/canvas-lms,Unow/canvas-lms,jay3126/canvas-lms,sfu/canvas-lms,tgroshon/canvas-lms,antoniuslin/canvas-lms,rup/Tarrax,rup/Tarrax,efrj/canvas-lms,antoniuslin/canvas-lms,jay3126/canvas-lms,whalejasmine/canvas-lms,utkarshx/canvas-lms,ShreniiNepal/shrenii_lmp,arrivu/arrivu-lms,kyroskoh/canvas-lms,HotChalk/canvas-lms,grahamb/canvas-lms,Jyaasa/canvas-lms,utkarshx/canvas-lms,SwinburneOnline/canvas-lms,landonwilkins/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,Jyaasa/canvas-lms,grahamb/canvas-lms,antoniuslin/canvas-lms,Rvor/canvas-lms,juoni/canvas-lms,venturehive/canvas-lms,efrj/canvas-lms,wrdsb/canvas-lms,wimemx/Canvas,arrivu/arrivu-lms,Unow/canvas-lms,greyhwndz/canvas-lms