Hi all, I know it has been discussed before [1] but one of our customers complained about something weird on one of their multi-tenancy databases (thousands of schemas with a lot of objects inside and one user by schema).
So when I checked the problem is because the missing TOAST for pg_class, and is easy to break it by just: fabrizio=# create table foo (id int); CREATE TABLE fabrizio=# do $$ begin for i in 1..2500 loop execute 'create user u' || i; execute 'grant all on foo to u' || i; end loop; end; $$; ERROR: row is too big: size 8168, maximum size 8160 CONTEXT: SQL statement "grant all on foo to u2445" PL/pgSQL function inline_code_block line 6 at EXECUTE Attached patch adds the TOAST to pg_class, and let's open again the discussion around it. Regards, [1] https://www.postgresql.org/message-id/flat/84ddff04-f122-784b-b6c5-3536804495f8%40joeconway.com -- Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/ PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
diff --git a/src/include/catalog/toasting.h b/src/include/catalog/toasting.h index 51491c4513..729bc2cc66 100644 --- a/src/include/catalog/toasting.h +++ b/src/include/catalog/toasting.h @@ -51,6 +51,7 @@ extern void BootstrapToastTable(char *relName, /* normal catalogs */ DECLARE_TOAST(pg_aggregate, 4159, 4160); DECLARE_TOAST(pg_attrdef, 2830, 2831); +DECLARE_TOAST(pg_class, 4179, 4180); DECLARE_TOAST(pg_collation, 4161, 4162); DECLARE_TOAST(pg_constraint, 2832, 2833); DECLARE_TOAST(pg_default_acl, 4143, 4144); diff --git a/src/test/regress/expected/misc_sanity.out b/src/test/regress/expected/misc_sanity.out index 8538173ff8..0a2f5cc2a2 100644 --- a/src/test/regress/expected/misc_sanity.out +++ b/src/test/regress/expected/misc_sanity.out @@ -100,12 +100,9 @@ ORDER BY 1, 2; pg_attribute | attfdwoptions | text[] pg_attribute | attmissingval | anyarray pg_attribute | attoptions | text[] - pg_class | relacl | aclitem[] - pg_class | reloptions | text[] - pg_class | relpartbound | pg_node_tree pg_index | indexprs | pg_node_tree pg_index | indpred | pg_node_tree pg_largeobject | data | bytea pg_largeobject_metadata | lomacl | aclitem[] -(11 rows) +(8 rows)