pgsql: Refine our definition of what constitutes a system relation.
От | Robert Haas |
---|---|
Тема | pgsql: Refine our definition of what constitutes a system relation. |
Дата | |
Msg-id | E1VmDVn-0003wi-Re@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Refine our definition of what constitutes a system relation. Although user-defined relations can't be directly created in pg_catalog, it's possible for them to end up there, because you can create them in some other schema and then use ALTER TABLE .. SET SCHEMA to move them there. Previously, such relations couldn't afterwards be manipulated, because IsSystemRelation()/IsSystemClass() rejected all attempts to modify objects in the pg_catalog schema, regardless of their origin. With this patch, they now reject only those objects in pg_catalog which were created at initdb-time, allowing most operations on user-created tables in pg_catalog to proceed normally. This patch also adds new functions IsCatalogRelation() and IsCatalogClass(), which is similar to IsSystemRelation() and IsSystemClass() but with a slightly narrower definition: only TOAST tables of system catalogs are included, rather than *all* TOAST tables. This is currently used only for making decisions about when invalidation messages need to be sent, but upcoming logical decoding patches will find other uses for this information. Andres Freund, with some modifications by me. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/8e18d04d4daf34b8a557e2dc553a7754b255cd9a Modified Files -------------- src/backend/access/heap/heapam.c | 2 +- src/backend/catalog/aclchk.c | 2 +- src/backend/catalog/catalog.c | 70 ++++++++++++++++++++++++----- src/backend/catalog/heap.c | 11 ++++- src/backend/commands/cluster.c | 2 +- src/backend/commands/indexcmds.c | 5 ++- src/backend/commands/tablecmds.c | 6 +-- src/backend/commands/trigger.c | 2 +- src/backend/optimizer/util/plancat.c | 2 +- src/backend/rewrite/rewriteDefine.c | 2 +- src/backend/tcop/utility.c | 2 +- src/backend/utils/cache/inval.c | 8 ++-- src/include/catalog/catalog.h | 4 +- src/test/regress/expected/alter_table.out | 34 ++++++++++++++ src/test/regress/sql/alter_table.sql | 28 ++++++++++++ 15 files changed, 149 insertions(+), 31 deletions(-)
В списке pgsql-committers по дате отправления: