Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita475c60

Browse files
committed
Remove misplaced sanity check from heap_create().
Even when allow_system_table_mods is not set, we allow creation of anytype of SQL object in pg_catalog, except for relations. And you canget relations into pg_catalog, too, by initially creating them in someother schema and then moving them with ALTER .. SET SCHEMA. So thisrestriction, which prevents relations (only) from being created inpg_catalog directly, is fairly pointless. If we need a safety mechanismfor this, it should be placed further upstream, so that it affects allSQL objects uniformly, and picks up both CREATE and SET SCHEMA.For now, just rip it out, per discussion with Tom Lane.
1 parentd2c86a1 commita475c60

File tree

4 files changed

+5
-22
lines changed

4 files changed

+5
-22
lines changed

‎src/backend/bootstrap/bootparse.y

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ Boot_CreateStmt:
222222
RELKIND_RELATION,
223223
RELPERSISTENCE_PERMANENT,
224224
shared_relation,
225-
mapped_relation,
226-
true);
225+
mapped_relation);
227226
elog(DEBUG4,"bootstrap relation created");
228227
}
229228
else

‎src/backend/catalog/heap.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -242,27 +242,14 @@ heap_create(const char *relname,
242242
charrelkind,
243243
charrelpersistence,
244244
boolshared_relation,
245-
boolmapped_relation,
246-
boolallow_system_table_mods)
245+
boolmapped_relation)
247246
{
248247
boolcreate_storage;
249248
Relationrel;
250249

251250
/* The caller must have provided an OID for the relation. */
252251
Assert(OidIsValid(relid));
253252

254-
/*
255-
* sanity checks
256-
*/
257-
if (!allow_system_table_mods&&
258-
(IsSystemNamespace(relnamespace)||IsToastNamespace(relnamespace))&&
259-
IsNormalProcessingMode())
260-
ereport(ERROR,
261-
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
262-
errmsg("permission denied to create \"%s.%s\"",
263-
get_namespace_name(relnamespace),relname),
264-
errdetail("System catalog modifications are currently disallowed.")));
265-
266253
/*
267254
* Decide if we need storage or not, and handle a couple other special
268255
* cases for particular relkinds.
@@ -1124,8 +1111,7 @@ heap_create_with_catalog(const char *relname,
11241111
relkind,
11251112
relpersistence,
11261113
shared_relation,
1127-
mapped_relation,
1128-
allow_system_table_mods);
1114+
mapped_relation);
11291115

11301116
Assert(relid==RelationGetRelid(new_rel_desc));
11311117

‎src/backend/catalog/index.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,7 @@ index_create(Relation heapRelation,
816816
RELKIND_INDEX,
817817
relpersistence,
818818
shared_relation,
819-
mapped_relation,
820-
allow_system_table_mods);
819+
mapped_relation);
821820

822821
Assert(indexRelationId==RelationGetRelid(indexRelation));
823822

‎src/include/catalog/heap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ extern Relation heap_create(const char *relname,
4646
charrelkind,
4747
charrelpersistence,
4848
boolshared_relation,
49-
boolmapped_relation,
50-
boolallow_system_table_mods);
49+
boolmapped_relation);
5150

5251
externOidheap_create_with_catalog(constchar*relname,
5352
Oidrelnamespace,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp