aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-07-15 11:41:47 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-07-15 11:41:47 -0400
commita49d081235997c67e8aab7a523b17e8d1cb93184 (patch)
tree4bf81347757488fc1ab5c651dc4f3ab0eb1b8a87 /src/backend/commands/tablespace.c
parente529b2dc37ac80ccebd76cdbb14966d3b40819c9 (diff)
downloadpostgresql-a49d081235997c67e8aab7a523b17e8d1cb93184.tar.gz
postgresql-a49d081235997c67e8aab7a523b17e8d1cb93184.zip
Replace explicit PIN entries in pg_depend with an OID range test.
As of v14, pg_depend contains almost 7000 "pin" entries recording the OIDs of built-in objects. This is a fair amount of bloat for every database, and it adds time to pg_depend lookups as well as initdb. We can get rid of all of those entries in favor of an OID range check, i.e. "OIDs below FirstUnpinnedObjectId are pinned". (template1 and the public schema are exceptions. Those exceptions are now wired into IsPinnedObject() instead of initdb's code for filling pg_depend, but it's the same amount of cruft either way.) The contents of pg_shdepend are modified likewise. Discussion: https://postgr.es/m/3737988.1618451008@sss.pgh.pa.us
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 69ea155d502..0385fd61214 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -449,7 +449,6 @@ DropTableSpace(DropTableSpaceStmt *stmt)
ereport(NOTICE,
(errmsg("tablespace \"%s\" does not exist, skipping",
tablespacename)));
- /* XXX I assume I need one or both of these next two calls */
table_endscan(scandesc);
table_close(rel, NoLock);
}
@@ -465,8 +464,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
tablespacename);
/* Disallow drop of the standard tablespaces, even by superuser */
- if (tablespaceoid == GLOBALTABLESPACE_OID ||
- tablespaceoid == DEFAULTTABLESPACE_OID)
+ if (IsPinnedObject(TableSpaceRelationId, tablespaceoid))
aclcheck_error(ACLCHECK_NO_PRIV, OBJECT_TABLESPACE,
tablespacename);