mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 12:01:24 +02:00
Put back allow_system_table_mods check in heap_create().
This reverts commit a475c60367
.
Erik Rijkers reported back in January 2013 that after the patch, if you do
"pg_dump -t myschema.mytable" to dump a single table, and restore that in
a database where myschema does not exist, the table is silently created in
pg_catalog instead. That is because pg_dump uses
"SET search_path=myschema, pg_catalog" to set schema the table is created
in. While allow_system_table_mods is not a very elegant solution to this,
we can't leave it as it is, so for now, revert it back to the way it was
previously.
This commit is contained in:
parent
f129615fe7
commit
15386281a6
@ -222,7 +222,8 @@ Boot_CreateStmt:
|
|||||||
RELKIND_RELATION,
|
RELKIND_RELATION,
|
||||||
RELPERSISTENCE_PERMANENT,
|
RELPERSISTENCE_PERMANENT,
|
||||||
shared_relation,
|
shared_relation,
|
||||||
mapped_relation);
|
mapped_relation,
|
||||||
|
true);
|
||||||
elog(DEBUG4, "bootstrap relation created");
|
elog(DEBUG4, "bootstrap relation created");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -246,7 +246,8 @@ heap_create(const char *relname,
|
|||||||
char relkind,
|
char relkind,
|
||||||
char relpersistence,
|
char relpersistence,
|
||||||
bool shared_relation,
|
bool shared_relation,
|
||||||
bool mapped_relation)
|
bool mapped_relation,
|
||||||
|
bool allow_system_table_mods)
|
||||||
{
|
{
|
||||||
bool create_storage;
|
bool create_storage;
|
||||||
Relation rel;
|
Relation rel;
|
||||||
@ -254,6 +255,18 @@ heap_create(const char *relname,
|
|||||||
/* The caller must have provided an OID for the relation. */
|
/* The caller must have provided an OID for the relation. */
|
||||||
Assert(OidIsValid(relid));
|
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
|
* Decide if we need storage or not, and handle a couple other special
|
||||||
* cases for particular relkinds.
|
* cases for particular relkinds.
|
||||||
@ -1132,7 +1145,8 @@ heap_create_with_catalog(const char *relname,
|
|||||||
relkind,
|
relkind,
|
||||||
relpersistence,
|
relpersistence,
|
||||||
shared_relation,
|
shared_relation,
|
||||||
mapped_relation);
|
mapped_relation,
|
||||||
|
allow_system_table_mods);
|
||||||
|
|
||||||
Assert(relid == RelationGetRelid(new_rel_desc));
|
Assert(relid == RelationGetRelid(new_rel_desc));
|
||||||
|
|
||||||
|
@ -825,7 +825,8 @@ index_create(Relation heapRelation,
|
|||||||
RELKIND_INDEX,
|
RELKIND_INDEX,
|
||||||
relpersistence,
|
relpersistence,
|
||||||
shared_relation,
|
shared_relation,
|
||||||
mapped_relation);
|
mapped_relation,
|
||||||
|
allow_system_table_mods);
|
||||||
|
|
||||||
Assert(indexRelationId == RelationGetRelid(indexRelation));
|
Assert(indexRelationId == RelationGetRelid(indexRelation));
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ extern Relation heap_create(const char *relname,
|
|||||||
char relkind,
|
char relkind,
|
||||||
char relpersistence,
|
char relpersistence,
|
||||||
bool shared_relation,
|
bool shared_relation,
|
||||||
bool mapped_relation);
|
bool mapped_relation,
|
||||||
|
bool allow_system_table_mods);
|
||||||
|
|
||||||
extern Oid heap_create_with_catalog(const char *relname,
|
extern Oid heap_create_with_catalog(const char *relname,
|
||||||
Oid relnamespace,
|
Oid relnamespace,
|
||||||
|
Loading…
Reference in New Issue
Block a user