diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-07-15 11:41:47 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-07-15 11:41:47 -0400 |
commit | a49d081235997c67e8aab7a523b17e8d1cb93184 (patch) | |
tree | 4bf81347757488fc1ab5c651dc4f3ab0eb1b8a87 /src/backend/commands/tablecmds.c | |
parent | e529b2dc37ac80ccebd76cdbb14966d3b40819c9 (diff) | |
download | postgresql-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/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 96375814a8f..28b178f2089 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -5960,7 +5960,7 @@ alter_table_type_to_string(AlterTableType cmdtype) case AT_DropExpression: return "ALTER COLUMN ... DROP EXPRESSION"; case AT_CheckNotNull: - return NULL; /* not real grammar */ + return NULL; /* not real grammar */ case AT_SetStatistics: return "ALTER COLUMN ... SET STATISTICS"; case AT_SetOptions: @@ -5976,7 +5976,7 @@ alter_table_type_to_string(AlterTableType cmdtype) return "DROP COLUMN"; case AT_AddIndex: case AT_ReAddIndex: - return NULL; /* not real grammar */ + return NULL; /* not real grammar */ case AT_AddConstraint: case AT_AddConstraintRecurse: case AT_ReAddConstraint: @@ -5992,7 +5992,7 @@ alter_table_type_to_string(AlterTableType cmdtype) case AT_DropConstraintRecurse: return "DROP CONSTRAINT"; case AT_ReAddComment: - return NULL; /* not real grammar */ + return NULL; /* not real grammar */ case AT_AlterColumnType: return "ALTER COLUMN ... SET DATA TYPE"; case AT_AlterColumnGenericOptions: @@ -6016,7 +6016,7 @@ alter_table_type_to_string(AlterTableType cmdtype) case AT_ResetRelOptions: return "RESET"; case AT_ReplaceRelOptions: - return NULL; /* not real grammar */ + return NULL; /* not real grammar */ case AT_EnableTrig: return "ENABLE TRIGGER"; case AT_EnableAlwaysTrig: @@ -6074,7 +6074,7 @@ alter_table_type_to_string(AlterTableType cmdtype) case AT_DropIdentity: return "ALTER COLUMN ... DROP IDENTITY"; case AT_ReAddStatistics: - return NULL; /* not real grammar */ + return NULL; /* not real grammar */ } return NULL; @@ -6129,7 +6129,7 @@ ATSimplePermissions(AlterTableType cmdtype, Relation rel, int allowed_targets) if (action_str) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - /* translator: %s is a group of some SQL keywords */ + /* translator: %s is a group of some SQL keywords */ errmsg("ALTER action %s cannot be performed on relation \"%s\"", action_str, RelationGetRelationName(rel)), errdetail_relkind_not_supported(rel->rd_rel->relkind))); @@ -12080,10 +12080,6 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, Form_pg_depend foundDep = (Form_pg_depend) GETSTRUCT(depTup); ObjectAddress foundObject; - /* We don't expect any PIN dependencies on columns */ - if (foundDep->deptype == DEPENDENCY_PIN) - elog(ERROR, "cannot alter type of a pinned column"); - foundObject.classId = foundDep->classid; foundObject.objectId = foundDep->objid; foundObject.objectSubId = foundDep->objsubid; |