diff options
| author | Robert Haas | 2012-06-14 13:58:53 +0000 |
|---|---|---|
| committer | Robert Haas | 2012-06-14 13:58:53 +0000 |
| commit | a475c6036752c26dca538632b68fd2cc592976b7 (patch) | |
| tree | d6396fceca29a112638d621ea71eed61282ada00 | |
| parent | d2c86a1ccd17145eeed2377ff7930e2ccbf5869e (diff) | |
Remove misplaced sanity check from heap_create().
Even when allow_system_table_mods is not set, we allow creation of any
type of SQL object in pg_catalog, except for relations. And you can
get relations into pg_catalog, too, by initially creating them in some
other schema and then moving them with ALTER .. SET SCHEMA. So this
restriction, which prevents relations (only) from being created in
pg_catalog directly, is fairly pointless. If we need a safety mechanism
for this, it should be placed further upstream, so that it affects all
SQL objects uniformly, and picks up both CREATE and SET SCHEMA.
For now, just rip it out, per discussion with Tom Lane.
| -rw-r--r-- | src/backend/bootstrap/bootparse.y | 3 | ||||
| -rw-r--r-- | src/backend/catalog/heap.c | 18 | ||||
| -rw-r--r-- | src/backend/catalog/index.c | 3 | ||||
| -rw-r--r-- | src/include/catalog/heap.h | 3 |
4 files changed, 5 insertions, 22 deletions
diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index d7bc572740..18f0add852 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -222,8 +222,7 @@ Boot_CreateStmt: RELKIND_RELATION, RELPERSISTENCE_PERMANENT, shared_relation, - mapped_relation, - true); + mapped_relation); elog(DEBUG4, "bootstrap relation created"); } else diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index c959a469fd..c91df90038 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -242,8 +242,7 @@ heap_create(const char *relname, char relkind, char relpersistence, bool shared_relation, - bool mapped_relation, - bool allow_system_table_mods) + bool mapped_relation) { bool create_storage; Relation rel; @@ -252,18 +251,6 @@ heap_create(const char *relname, Assert(OidIsValid(relid)); /* - * sanity checks - */ - if (!allow_system_table_mods && - (IsSystemNamespace(relnamespace) || IsToastNamespace(relnamespace)) && - IsNormalProcessingMode()) - ereport(ERROR, - (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to create \"%s.%s\"", - get_namespace_name(relnamespace), relname), - errdetail("System catalog modifications are currently disallowed."))); - - /* * Decide if we need storage or not, and handle a couple other special * cases for particular relkinds. */ @@ -1124,8 +1111,7 @@ heap_create_with_catalog(const char *relname, relkind, relpersistence, shared_relation, - mapped_relation, - allow_system_table_mods); + mapped_relation); Assert(relid == RelationGetRelid(new_rel_desc)); diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 89d346886d..0c51923be8 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -816,8 +816,7 @@ index_create(Relation heapRelation, RELKIND_INDEX, relpersistence, shared_relation, - mapped_relation, - allow_system_table_mods); + mapped_relation); Assert(indexRelationId == RelationGetRelid(indexRelation)); diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index bc98d5d6fc..bc8c63a15e 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -46,8 +46,7 @@ extern Relation heap_create(const char *relname, char relkind, char relpersistence, bool shared_relation, - bool mapped_relation, - bool allow_system_table_mods); + bool mapped_relation); extern Oid heap_create_with_catalog(const char *relname, Oid relnamespace, |
