1

I am running into the row is too big (ERROR: 54000: row is too big: size 9976, maximum size 8160) error in Postgres related to role permissions on a couple of my instances. I understand that after v12 there was a TOAST table added to help mitigate that issue. I have upgraded the affected instances to v15, but the issue is still occurring.

I have seen many answers about how to structure permissions to avoid this problem, but have not had any luck in finding answers as to how to resolve the problem in a running database. In the email thread where the Postgres developers discussed the implementation of the TOAST tables to address this problem they alluded to manual steps needed to re-init a database to take advantage of the fix, but no reference to the actual steps.

For context, I am running on AWS RDS (not Aurora) and using Vault to generate dynamic database credentials. Because of the error I am unable to drop any permissions or modify existing permissions. I have also been unsuccessful in finding a way to locate the specific row in the pg_catalog that is generating the error.

Can someone please share any steps that they have taken to resolve this situation without having to recreate the entire database? Specifically, being able to drop permissions and users, and/or initialize the missing TOAST tables in the running database. Thank you for your help!

1 Answer 1

0

The problem is that the access control list for the table (column relacl) is part of the pg_class row for the table. That row has to fit into a single table block (8kB), so the row cannot grow any larger than that. If you grant permissions for too many roles on that table, you can get to this impasse.

The only possible solution is to redesign you permission model. Rather than granting privileges to hundreds of individual roles, use a group system: only the groups get privileges on your tables, and login roles are assigned membership in these roles.

4
  • We have changed the permission model, but now we are in a situation where we are unable to remove any entries from that ACL. Until we can remove those entries we are unable to make forward progress. Is it feasible to just issue a DELETE query against that record to reset the state of the database auth and the created roles? Commented Aug 28 at 17:47
  • You are unable to REVOKE some of the privileges? That's not what I would expect. Perhaps you'll have to dump the table (without privileges), drop and restore it. Commented Aug 29 at 6:50
  • Yes, I am unable to make any permission modifications for some of the database objects. For example: => revoke select on table auth_group from "v-aws-conc-readonly-U8JJaOXxb2s1h6kZtTZQ-1688158570"; ERROR: row is too big: size 9976, maximum size 8160 Commented Sep 3 at 18:12
  • Try revoking many or all privileges in a single statement. If that doesn't work either, dump/drop/restore is the way to go. Commented Sep 4 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.