You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After migrating the staging database, we saw this error when attempting to deploy. Short form of error: ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied for table schema_migrations.
I looked at the new postgres host and found that , turned out that the pulmap_staging database was owned by the pulmap_staging user, but the tables inside that database were owned by the postgres user:
pulmap_staging=# \dt
List of relations
Schema | Name | Type | Owner
--------+--------------------------------+-------+----------
public | active_storage_attachments | table | postgres
public | active_storage_blobs | table | postgres
public | active_storage_variant_records | table | postgres
public | ar_internal_metadata | table | postgres
public | bookmarks | table | postgres
public | schema_migrations | table | postgres
public | searches | table | postgres
public | sidecar_image_transitions | table | postgres
public | solr_document_sidecars | table | postgres
public | users | table | postgres
(10 rows)
I manually fixed the tables with:
$ for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" pulmap_staging` ; do psql -c "alter table \"$tbl\" owner to pulmap_staging" pulmap_staging ; done
so pulmap-staging is back up. We should find the root cause of this problem. It might be in the postgresql role, or in the database migration playbook, or both.
The text was updated successfully, but these errors were encountered:
If the tables are the only ones owned by the old user name, AND THE OLD USER NAME IS NOT THE postgres USER, you can also do REASSIGN OWNED BY olduser TO newuser;.
Don't ever do this with the postgres user, though, as that could change the ownership of vital administrative resources.
Related to #3280.
After migrating the staging database, we saw this error when attempting to deploy. Short form of error:
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied for table schema_migrations
.I looked at the new postgres host and found that , turned out that the
pulmap_staging
database was owned by thepulmap_staging
user, but the tables inside that database were owned by thepostgres
user:I manually fixed the tables with:
so pulmap-staging is back up. We should find the root cause of this problem. It might be in the postgresql role, or in the database migration playbook, or both.
The text was updated successfully, but these errors were encountered: