Commit b1d32d3e authored by Peter Eisentraut's avatar Peter Eisentraut

Unify drop-by-OID functions

There are a number of Remove${Something}ById() functions that are
essentially identical in structure and only different in which catalog
they are working on.  Refactor this to be one generic function.  The
information about which oid column, index, etc. to use was already
available in ObjectProperty for most catalogs, in a few cases it was
easily added.
Reviewed-by: default avatarPavel Stehule <pavel.stehule@gmail.com>
Reviewed-by: default avatarRobert Haas <robertmhaas@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/331d9661-1743-857f-1cbb-d5728bcd62cb%402ndquadrant.com
parent b27c90bb
...@@ -1498,39 +1498,6 @@ RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid) ...@@ -1498,39 +1498,6 @@ RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid)
} }
/*
* Remove a pg_default_acl entry
*/
void
RemoveDefaultACLById(Oid defaclOid)
{
Relation rel;
ScanKeyData skey[1];
SysScanDesc scan;
HeapTuple tuple;
rel = table_open(DefaultAclRelationId, RowExclusiveLock);
ScanKeyInit(&skey[0],
Anum_pg_default_acl_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(defaclOid));
scan = systable_beginscan(rel, DefaultAclOidIndexId, true,
NULL, 1, skey);
tuple = systable_getnext(scan);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for default ACL %u", defaclOid);
CatalogTupleDelete(rel, &tuple->t_self);
systable_endscan(scan);
table_close(rel, RowExclusiveLock);
}
/* /*
* expand_col_privileges * expand_col_privileges
* *
......
...@@ -66,9 +66,7 @@ ...@@ -66,9 +66,7 @@
#include "commands/event_trigger.h" #include "commands/event_trigger.h"
#include "commands/extension.h" #include "commands/extension.h"
#include "commands/policy.h" #include "commands/policy.h"
#include "commands/proclang.h"
#include "commands/publicationcmds.h" #include "commands/publicationcmds.h"
#include "commands/schemacmds.h"
#include "commands/seclabel.h" #include "commands/seclabel.h"
#include "commands/sequence.h" #include "commands/sequence.h"
#include "commands/trigger.h" #include "commands/trigger.h"
...@@ -1223,6 +1221,62 @@ reportDependentObjects(const ObjectAddresses *targetObjects, ...@@ -1223,6 +1221,62 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
pfree(logdetail.data); pfree(logdetail.data);
} }
/*
* Drop an object by OID. Works for most catalogs, if no special processing
* is needed.
*/
static void
DropObjectById(const ObjectAddress *object)
{
int cacheId;
Relation rel;
HeapTuple tup;
cacheId = get_object_catcache_oid(object->classId);
rel = table_open(object->classId, RowExclusiveLock);
/*
* Use the system cache for the oid column, if one exists.
*/
if (cacheId >= 0)
{
tup = SearchSysCache1(cacheId, ObjectIdGetDatum(object->objectId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for %s %u",
get_object_class_descr(object->classId), object->objectId);
CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup);
}
else
{
ScanKeyData skey[1];
SysScanDesc scan;
ScanKeyInit(&skey[0],
get_object_attnum_oid(object->classId),
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(object->objectId));
scan = systable_beginscan(rel, get_object_oid_index(object->classId), true,
NULL, 1, skey);
/* we expect exactly one match */
tup = systable_getnext(scan);
if (!HeapTupleIsValid(tup))
elog(ERROR, "could not find tuple for %s %u",
get_object_class_descr(object->classId), object->objectId);
CatalogTupleDelete(rel, &tup->t_self);
systable_endscan(scan);
}
table_close(rel, RowExclusiveLock);
}
/* /*
* deleteOneObject: delete a single object for performDeletion. * deleteOneObject: delete a single object for performDeletion.
* *
...@@ -1376,30 +1430,14 @@ doDeletion(const ObjectAddress *object, int flags) ...@@ -1376,30 +1430,14 @@ doDeletion(const ObjectAddress *object, int flags)
RemoveTypeById(object->objectId); RemoveTypeById(object->objectId);
break; break;
case OCLASS_CAST:
DropCastById(object->objectId);
break;
case OCLASS_COLLATION:
RemoveCollationById(object->objectId);
break;
case OCLASS_CONSTRAINT: case OCLASS_CONSTRAINT:
RemoveConstraintById(object->objectId); RemoveConstraintById(object->objectId);
break; break;
case OCLASS_CONVERSION:
RemoveConversionById(object->objectId);
break;
case OCLASS_DEFAULT: case OCLASS_DEFAULT:
RemoveAttrDefaultById(object->objectId); RemoveAttrDefaultById(object->objectId);
break; break;
case OCLASS_LANGUAGE:
DropProceduralLanguageById(object->objectId);
break;
case OCLASS_LARGEOBJECT: case OCLASS_LARGEOBJECT:
LargeObjectDrop(object->objectId); LargeObjectDrop(object->objectId);
break; break;
...@@ -1408,26 +1446,6 @@ doDeletion(const ObjectAddress *object, int flags) ...@@ -1408,26 +1446,6 @@ doDeletion(const ObjectAddress *object, int flags)
RemoveOperatorById(object->objectId); RemoveOperatorById(object->objectId);
break; break;
case OCLASS_OPCLASS:
RemoveOpClassById(object->objectId);
break;
case OCLASS_OPFAMILY:
RemoveOpFamilyById(object->objectId);
break;
case OCLASS_AM:
RemoveAccessMethodById(object->objectId);
break;
case OCLASS_AMOP:
RemoveAmOpEntryById(object->objectId);
break;
case OCLASS_AMPROC:
RemoveAmProcEntryById(object->objectId);
break;
case OCLASS_REWRITE: case OCLASS_REWRITE:
RemoveRewriteRuleById(object->objectId); RemoveRewriteRuleById(object->objectId);
break; break;
...@@ -1436,73 +1454,47 @@ doDeletion(const ObjectAddress *object, int flags) ...@@ -1436,73 +1454,47 @@ doDeletion(const ObjectAddress *object, int flags)
RemoveTriggerById(object->objectId); RemoveTriggerById(object->objectId);
break; break;
case OCLASS_SCHEMA:
RemoveSchemaById(object->objectId);
break;
case OCLASS_STATISTIC_EXT: case OCLASS_STATISTIC_EXT:
RemoveStatisticsById(object->objectId); RemoveStatisticsById(object->objectId);
break; break;
case OCLASS_TSPARSER:
RemoveTSParserById(object->objectId);
break;
case OCLASS_TSDICT:
RemoveTSDictionaryById(object->objectId);
break;
case OCLASS_TSTEMPLATE:
RemoveTSTemplateById(object->objectId);
break;
case OCLASS_TSCONFIG: case OCLASS_TSCONFIG:
RemoveTSConfigurationById(object->objectId); RemoveTSConfigurationById(object->objectId);
break; break;
/*
* OCLASS_ROLE, OCLASS_DATABASE, OCLASS_TBLSPACE intentionally not
* handled here
*/
case OCLASS_FDW:
RemoveForeignDataWrapperById(object->objectId);
break;
case OCLASS_FOREIGN_SERVER:
RemoveForeignServerById(object->objectId);
break;
case OCLASS_USER_MAPPING:
RemoveUserMappingById(object->objectId);
break;
case OCLASS_DEFACL:
RemoveDefaultACLById(object->objectId);
break;
case OCLASS_EXTENSION: case OCLASS_EXTENSION:
RemoveExtensionById(object->objectId); RemoveExtensionById(object->objectId);
break; break;
case OCLASS_EVENT_TRIGGER:
RemoveEventTriggerById(object->objectId);
break;
case OCLASS_POLICY: case OCLASS_POLICY:
RemovePolicyById(object->objectId); RemovePolicyById(object->objectId);
break; break;
case OCLASS_PUBLICATION:
RemovePublicationById(object->objectId);
break;
case OCLASS_PUBLICATION_REL: case OCLASS_PUBLICATION_REL:
RemovePublicationRelById(object->objectId); RemovePublicationRelById(object->objectId);
break; break;
case OCLASS_CAST:
case OCLASS_COLLATION:
case OCLASS_CONVERSION:
case OCLASS_LANGUAGE:
case OCLASS_OPCLASS:
case OCLASS_OPFAMILY:
case OCLASS_AM:
case OCLASS_AMOP:
case OCLASS_AMPROC:
case OCLASS_SCHEMA:
case OCLASS_TSPARSER:
case OCLASS_TSDICT:
case OCLASS_TSTEMPLATE:
case OCLASS_FDW:
case OCLASS_FOREIGN_SERVER:
case OCLASS_USER_MAPPING:
case OCLASS_DEFACL:
case OCLASS_EVENT_TRIGGER:
case OCLASS_PUBLICATION:
case OCLASS_TRANSFORM: case OCLASS_TRANSFORM:
DropTransformById(object->objectId); DropObjectById(object);
break; break;
/* /*
......
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
*/ */
typedef struct typedef struct
{ {
const char *class_descr; /* string describing the catalog, for internal error messages */
Oid class_oid; /* oid of catalog */ Oid class_oid; /* oid of catalog */
Oid oid_index_oid; /* oid of index on system oid column */ Oid oid_index_oid; /* oid of index on system oid column */
int oid_catcache_id; /* id of catcache on system oid column */ int oid_catcache_id; /* id of catcache on system oid column */
...@@ -118,6 +119,7 @@ typedef struct ...@@ -118,6 +119,7 @@ typedef struct
static const ObjectPropertyType ObjectProperty[] = static const ObjectPropertyType ObjectProperty[] =
{ {
{ {
"access method",
AccessMethodRelationId, AccessMethodRelationId,
AmOidIndexId, AmOidIndexId,
AMOID, AMOID,
...@@ -131,6 +133,35 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -131,6 +133,35 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"access method operator",
AccessMethodOperatorRelationId,
AccessMethodOperatorOidIndexId,
-1,
-1,
Anum_pg_amop_oid,
InvalidAttrNumber,
InvalidAttrNumber,
InvalidAttrNumber,
InvalidAttrNumber,
OBJECT_AMOP,
false
},
{
"access method procedure",
AccessMethodProcedureRelationId,
AccessMethodProcedureOidIndexId,
-1,
-1,
Anum_pg_amproc_oid,
InvalidAttrNumber,
InvalidAttrNumber,
InvalidAttrNumber,
InvalidAttrNumber,
OBJECT_AMPROC,
false
},
{
"cast",
CastRelationId, CastRelationId,
CastOidIndexId, CastOidIndexId,
-1, -1,
...@@ -144,6 +175,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -144,6 +175,7 @@ static const ObjectPropertyType ObjectProperty[] =
false false
}, },
{ {
"collation",
CollationRelationId, CollationRelationId,
CollationOidIndexId, CollationOidIndexId,
COLLOID, COLLOID,
...@@ -157,6 +189,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -157,6 +189,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"constraint",
ConstraintRelationId, ConstraintRelationId,
ConstraintOidIndexId, ConstraintOidIndexId,
CONSTROID, CONSTROID,
...@@ -170,6 +203,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -170,6 +203,7 @@ static const ObjectPropertyType ObjectProperty[] =
false false
}, },
{ {
"conversion",
ConversionRelationId, ConversionRelationId,
ConversionOidIndexId, ConversionOidIndexId,
CONVOID, CONVOID,
...@@ -183,6 +217,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -183,6 +217,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"database",
DatabaseRelationId, DatabaseRelationId,
DatabaseOidIndexId, DatabaseOidIndexId,
DATABASEOID, DATABASEOID,
...@@ -196,6 +231,21 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -196,6 +231,21 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"default ACL",
DefaultAclRelationId,
DefaultAclOidIndexId,
-1,
-1,
Anum_pg_default_acl_oid,
InvalidAttrNumber,
InvalidAttrNumber,
InvalidAttrNumber,
InvalidAttrNumber,
OBJECT_DEFACL,
false
},
{
"extension",
ExtensionRelationId, ExtensionRelationId,
ExtensionOidIndexId, ExtensionOidIndexId,
-1, -1,
...@@ -209,6 +259,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -209,6 +259,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"foreign-data wrapper",
ForeignDataWrapperRelationId, ForeignDataWrapperRelationId,
ForeignDataWrapperOidIndexId, ForeignDataWrapperOidIndexId,
FOREIGNDATAWRAPPEROID, FOREIGNDATAWRAPPEROID,
...@@ -222,6 +273,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -222,6 +273,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"foreign server",
ForeignServerRelationId, ForeignServerRelationId,
ForeignServerOidIndexId, ForeignServerOidIndexId,
FOREIGNSERVEROID, FOREIGNSERVEROID,
...@@ -235,6 +287,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -235,6 +287,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"function",
ProcedureRelationId, ProcedureRelationId,
ProcedureOidIndexId, ProcedureOidIndexId,
PROCOID, PROCOID,
...@@ -248,6 +301,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -248,6 +301,7 @@ static const ObjectPropertyType ObjectProperty[] =
false false
}, },
{ {
"language",
LanguageRelationId, LanguageRelationId,
LanguageOidIndexId, LanguageOidIndexId,
LANGOID, LANGOID,
...@@ -261,6 +315,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -261,6 +315,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"large object metadata",
LargeObjectMetadataRelationId, LargeObjectMetadataRelationId,
LargeObjectMetadataOidIndexId, LargeObjectMetadataOidIndexId,
-1, -1,
...@@ -274,6 +329,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -274,6 +329,7 @@ static const ObjectPropertyType ObjectProperty[] =
false false
}, },
{ {
"operator class",
OperatorClassRelationId, OperatorClassRelationId,
OpclassOidIndexId, OpclassOidIndexId,
CLAOID, CLAOID,
...@@ -287,6 +343,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -287,6 +343,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"operator",
OperatorRelationId, OperatorRelationId,
OperatorOidIndexId, OperatorOidIndexId,
OPEROID, OPEROID,
...@@ -300,6 +357,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -300,6 +357,7 @@ static const ObjectPropertyType ObjectProperty[] =
false false
}, },
{ {
"operator family",
OperatorFamilyRelationId, OperatorFamilyRelationId,
OpfamilyOidIndexId, OpfamilyOidIndexId,
OPFAMILYOID, OPFAMILYOID,
...@@ -313,6 +371,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -313,6 +371,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"role",
AuthIdRelationId, AuthIdRelationId,
AuthIdOidIndexId, AuthIdOidIndexId,
AUTHOID, AUTHOID,
...@@ -326,6 +385,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -326,6 +385,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"rule",
RewriteRelationId, RewriteRelationId,
RewriteOidIndexId, RewriteOidIndexId,
-1, -1,
...@@ -339,6 +399,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -339,6 +399,7 @@ static const ObjectPropertyType ObjectProperty[] =
false false
}, },
{ {
"schema",
NamespaceRelationId, NamespaceRelationId,
NamespaceOidIndexId, NamespaceOidIndexId,
NAMESPACEOID, NAMESPACEOID,
...@@ -352,6 +413,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -352,6 +413,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"relation",
RelationRelationId, RelationRelationId,
ClassOidIndexId, ClassOidIndexId,
RELOID, RELOID,
...@@ -365,6 +427,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -365,6 +427,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"tablespace",
TableSpaceRelationId, TableSpaceRelationId,
TablespaceOidIndexId, TablespaceOidIndexId,
TABLESPACEOID, TABLESPACEOID,
...@@ -378,6 +441,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -378,6 +441,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"transform",
TransformRelationId, TransformRelationId,
TransformOidIndexId, TransformOidIndexId,
TRFOID, TRFOID,
...@@ -385,6 +449,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -385,6 +449,7 @@ static const ObjectPropertyType ObjectProperty[] =
Anum_pg_transform_oid Anum_pg_transform_oid
}, },
{ {
"trigger",
TriggerRelationId, TriggerRelationId,
TriggerOidIndexId, TriggerOidIndexId,
-1, -1,
...@@ -398,6 +463,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -398,6 +463,7 @@ static const ObjectPropertyType ObjectProperty[] =
false false
}, },
{ {
"policy",
PolicyRelationId, PolicyRelationId,
PolicyOidIndexId, PolicyOidIndexId,
-1, -1,
...@@ -411,6 +477,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -411,6 +477,7 @@ static const ObjectPropertyType ObjectProperty[] =
false false
}, },
{ {
"event trigger",
EventTriggerRelationId, EventTriggerRelationId,
EventTriggerOidIndexId, EventTriggerOidIndexId,
EVENTTRIGGEROID, EVENTTRIGGEROID,
...@@ -424,6 +491,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -424,6 +491,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"text search configuration",
TSConfigRelationId, TSConfigRelationId,
TSConfigOidIndexId, TSConfigOidIndexId,
TSCONFIGOID, TSCONFIGOID,
...@@ -437,6 +505,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -437,6 +505,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"text search dictionary",
TSDictionaryRelationId, TSDictionaryRelationId,
TSDictionaryOidIndexId, TSDictionaryOidIndexId,
TSDICTOID, TSDICTOID,
...@@ -450,6 +519,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -450,6 +519,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"text search parser",
TSParserRelationId, TSParserRelationId,
TSParserOidIndexId, TSParserOidIndexId,
TSPARSEROID, TSPARSEROID,
...@@ -463,6 +533,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -463,6 +533,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"text search template",
TSTemplateRelationId, TSTemplateRelationId,
TSTemplateOidIndexId, TSTemplateOidIndexId,
TSTEMPLATEOID, TSTEMPLATEOID,
...@@ -476,6 +547,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -476,6 +547,7 @@ static const ObjectPropertyType ObjectProperty[] =
true, true,
}, },
{ {
"type",
TypeRelationId, TypeRelationId,
TypeOidIndexId, TypeOidIndexId,
TYPEOID, TYPEOID,
...@@ -489,6 +561,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -489,6 +561,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"publication",
PublicationRelationId, PublicationRelationId,
PublicationObjectIndexId, PublicationObjectIndexId,
PUBLICATIONOID, PUBLICATIONOID,
...@@ -502,6 +575,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -502,6 +575,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"subscription",
SubscriptionRelationId, SubscriptionRelationId,
SubscriptionObjectIndexId, SubscriptionObjectIndexId,
SUBSCRIPTIONOID, SUBSCRIPTIONOID,
...@@ -515,6 +589,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -515,6 +589,7 @@ static const ObjectPropertyType ObjectProperty[] =
true true
}, },
{ {
"extented statistics",
StatisticExtRelationId, StatisticExtRelationId,
StatisticExtOidIndexId, StatisticExtOidIndexId,
STATEXTOID, STATEXTOID,
...@@ -526,7 +601,21 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -526,7 +601,21 @@ static const ObjectPropertyType ObjectProperty[] =
InvalidAttrNumber, /* no ACL (same as relation) */ InvalidAttrNumber, /* no ACL (same as relation) */
OBJECT_STATISTIC_EXT, OBJECT_STATISTIC_EXT,
true true
} },
{
"user mapping",
UserMappingRelationId,
UserMappingOidIndexId,
USERMAPPINGOID,
-1,
Anum_pg_user_mapping_oid,
InvalidAttrNumber,
InvalidAttrNumber,
InvalidAttrNumber,
InvalidAttrNumber,
OBJECT_USER_MAPPING,
false
},
}; };
/* /*
...@@ -2549,6 +2638,14 @@ read_objtype_from_string(const char *objtype) ...@@ -2549,6 +2638,14 @@ read_objtype_from_string(const char *objtype)
/* /*
* Interfaces to reference fields of ObjectPropertyType * Interfaces to reference fields of ObjectPropertyType
*/ */
const char *
get_object_class_descr(Oid class_id)
{
const ObjectPropertyType *prop = get_object_property_data(class_id);
return prop->class_descr;
}
Oid Oid
get_object_oid_index(Oid class_id) get_object_oid_index(Oid class_id)
{ {
......
...@@ -203,39 +203,3 @@ CollationCreate(const char *collname, Oid collnamespace, ...@@ -203,39 +203,3 @@ CollationCreate(const char *collname, Oid collnamespace,
return oid; return oid;
} }
/*
* RemoveCollationById
*
* Remove a tuple from pg_collation by Oid. This function is solely
* called inside catalog/dependency.c
*/
void
RemoveCollationById(Oid collationOid)
{
Relation rel;
ScanKeyData scanKeyData;
SysScanDesc scandesc;
HeapTuple tuple;
rel = table_open(CollationRelationId, RowExclusiveLock);
ScanKeyInit(&scanKeyData,
Anum_pg_collation_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(collationOid));
scandesc = systable_beginscan(rel, CollationOidIndexId, true,
NULL, 1, &scanKeyData);
tuple = systable_getnext(scandesc);
if (HeapTupleIsValid(tuple))
CatalogTupleDelete(rel, &tuple->t_self);
else
elog(ERROR, "could not find tuple for collation %u", collationOid);
systable_endscan(scandesc);
table_close(rel, RowExclusiveLock);
}
...@@ -142,39 +142,6 @@ ConversionCreate(const char *conname, Oid connamespace, ...@@ -142,39 +142,6 @@ ConversionCreate(const char *conname, Oid connamespace,
return myself; return myself;
} }
/*
* RemoveConversionById
*
* Remove a tuple from pg_conversion by Oid. This function is solely
* called inside catalog/dependency.c
*/
void
RemoveConversionById(Oid conversionOid)
{
Relation rel;
HeapTuple tuple;
TableScanDesc scan;
ScanKeyData scanKeyData;
ScanKeyInit(&scanKeyData,
Anum_pg_conversion_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(conversionOid));
/* open pg_conversion */
rel = table_open(ConversionRelationId, RowExclusiveLock);
scan = table_beginscan_catalog(rel, 1, &scanKeyData);
/* search for the target tuple */
if (HeapTupleIsValid(tuple = heap_getnext(scan, ForwardScanDirection)))
CatalogTupleDelete(rel, &tuple->t_self);
else
elog(ERROR, "could not find tuple for conversion %u", conversionOid);
table_endscan(scan);
table_close(rel, RowExclusiveLock);
}
/* /*
* FindDefaultConversion * FindDefaultConversion
* *
......
...@@ -115,33 +115,6 @@ CreateAccessMethod(CreateAmStmt *stmt) ...@@ -115,33 +115,6 @@ CreateAccessMethod(CreateAmStmt *stmt)
return myself; return myself;
} }
/*
* Guts of access method deletion.
*/
void
RemoveAccessMethodById(Oid amOid)
{
Relation relation;
HeapTuple tup;
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to drop access methods")));
relation = table_open(AccessMethodRelationId, RowExclusiveLock);
tup = SearchSysCache1(AMOID, ObjectIdGetDatum(amOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for access method %u", amOid);
CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup);
table_close(relation, RowExclusiveLock);
}
/* /*
* get_am_type_oid * get_am_type_oid
* Worker for various get_am_*_oid variants * Worker for various get_am_*_oid variants
......
...@@ -355,28 +355,6 @@ filter_list_to_array(List *filterlist) ...@@ -355,28 +355,6 @@ filter_list_to_array(List *filterlist)
-1, false, TYPALIGN_INT)); -1, false, TYPALIGN_INT));
} }
/*
* Guts of event trigger deletion.
*/
void
RemoveEventTriggerById(Oid trigOid)
{
Relation tgrel;
HeapTuple tup;
tgrel = table_open(EventTriggerRelationId, RowExclusiveLock);
tup = SearchSysCache1(EVENTTRIGGEROID, ObjectIdGetDatum(trigOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for event trigger %u", trigOid);
CatalogTupleDelete(tgrel, &tup->t_self);
ReleaseSysCache(tup);
table_close(tgrel, RowExclusiveLock);
}
/* /*
* ALTER EVENT TRIGGER foo ENABLE|DISABLE|ENABLE ALWAYS|REPLICA * ALTER EVENT TRIGGER foo ENABLE|DISABLE|ENABLE ALWAYS|REPLICA
*/ */
......
...@@ -835,30 +835,6 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) ...@@ -835,30 +835,6 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
} }
/*
* Drop foreign-data wrapper by OID
*/
void
RemoveForeignDataWrapperById(Oid fdwId)
{
HeapTuple tp;
Relation rel;
rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwId);
CatalogTupleDelete(rel, &tp->t_self);
ReleaseSysCache(tp);
table_close(rel, RowExclusiveLock);
}
/* /*
* Create a foreign server * Create a foreign server
*/ */
...@@ -1085,30 +1061,6 @@ AlterForeignServer(AlterForeignServerStmt *stmt) ...@@ -1085,30 +1061,6 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
} }
/*
* Drop foreign server by OID
*/
void
RemoveForeignServerById(Oid srvId)
{
HeapTuple tp;
Relation rel;
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srvId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for foreign server %u", srvId);
CatalogTupleDelete(rel, &tp->t_self);
ReleaseSysCache(tp);
table_close(rel, RowExclusiveLock);
}
/* /*
* Common routine to check permission for user-mapping-related DDL * Common routine to check permission for user-mapping-related DDL
* commands. We allow server owners to operate on any mapping, and * commands. We allow server owners to operate on any mapping, and
...@@ -1435,29 +1387,6 @@ RemoveUserMapping(DropUserMappingStmt *stmt) ...@@ -1435,29 +1387,6 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
} }
/*
* Drop user mapping by OID. This is called to clean up dependencies.
*/
void
RemoveUserMappingById(Oid umId)
{
HeapTuple tp;
Relation rel;
rel = table_open(UserMappingRelationId, RowExclusiveLock);
tp = SearchSysCache1(USERMAPPINGOID, ObjectIdGetDatum(umId));
if (!HeapTupleIsValid(tp))
elog(ERROR, "cache lookup failed for user mapping %u", umId);
CatalogTupleDelete(rel, &tp->t_self);
ReleaseSysCache(tp);
table_close(rel, RowExclusiveLock);
}
/* /*
* Create a foreign table * Create a foreign table
* call after DefineRelation(). * call after DefineRelation().
......
...@@ -1646,32 +1646,6 @@ CreateCast(CreateCastStmt *stmt) ...@@ -1646,32 +1646,6 @@ CreateCast(CreateCastStmt *stmt)
return myself; return myself;
} }
void
DropCastById(Oid castOid)
{
Relation relation;
ScanKeyData scankey;
SysScanDesc scan;
HeapTuple tuple;
relation = table_open(CastRelationId, RowExclusiveLock);
ScanKeyInit(&scankey,
Anum_pg_cast_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(castOid));
scan = systable_beginscan(relation, CastOidIndexId, true,
NULL, 1, &scankey);
tuple = systable_getnext(scan);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for cast %u", castOid);
CatalogTupleDelete(relation, &tuple->t_self);
systable_endscan(scan);
table_close(relation, RowExclusiveLock);
}
static void static void
check_transform_function(Form_pg_proc procstruct) check_transform_function(Form_pg_proc procstruct)
...@@ -1933,33 +1907,6 @@ get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok) ...@@ -1933,33 +1907,6 @@ get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok)
} }
void
DropTransformById(Oid transformOid)
{
Relation relation;
ScanKeyData scankey;
SysScanDesc scan;
HeapTuple tuple;
relation = table_open(TransformRelationId, RowExclusiveLock);
ScanKeyInit(&scankey,
Anum_pg_transform_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(transformOid));
scan = systable_beginscan(relation, TransformOidIndexId, true,
NULL, 1, &scankey);
tuple = systable_getnext(scan);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for transform %u", transformOid);
CatalogTupleDelete(relation, &tuple->t_self);
systable_endscan(scan);
table_close(relation, RowExclusiveLock);
}
/* /*
* Subroutine for ALTER FUNCTION/AGGREGATE SET SCHEMA/RENAME * Subroutine for ALTER FUNCTION/AGGREGATE SET SCHEMA/RENAME
* *
......
...@@ -1657,105 +1657,6 @@ dropProcedures(List *opfamilyname, Oid amoid, Oid opfamilyoid, ...@@ -1657,105 +1657,6 @@ dropProcedures(List *opfamilyname, Oid amoid, Oid opfamilyoid,
} }
} }
/*
* Deletion subroutines for use by dependency.c.
*/
void
RemoveOpFamilyById(Oid opfamilyOid)
{
Relation rel;
HeapTuple tup;
rel = table_open(OperatorFamilyRelationId, RowExclusiveLock);
tup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opfamily %u", opfamilyOid);
CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup);
table_close(rel, RowExclusiveLock);
}
void
RemoveOpClassById(Oid opclassOid)
{
Relation rel;
HeapTuple tup;
rel = table_open(OperatorClassRelationId, RowExclusiveLock);
tup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for opclass %u", opclassOid);
CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup);
table_close(rel, RowExclusiveLock);
}
void
RemoveAmOpEntryById(Oid entryOid)
{
Relation rel;
HeapTuple tup;
ScanKeyData skey[1];
SysScanDesc scan;
ScanKeyInit(&skey[0],
Anum_pg_amop_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(entryOid));
rel = table_open(AccessMethodOperatorRelationId, RowExclusiveLock);
scan = systable_beginscan(rel, AccessMethodOperatorOidIndexId, true,
NULL, 1, skey);
/* we expect exactly one match */
tup = systable_getnext(scan);
if (!HeapTupleIsValid(tup))
elog(ERROR, "could not find tuple for amop entry %u", entryOid);
CatalogTupleDelete(rel, &tup->t_self);
systable_endscan(scan);
table_close(rel, RowExclusiveLock);
}
void
RemoveAmProcEntryById(Oid entryOid)
{
Relation rel;
HeapTuple tup;
ScanKeyData skey[1];
SysScanDesc scan;
ScanKeyInit(&skey[0],
Anum_pg_amproc_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(entryOid));
rel = table_open(AccessMethodProcedureRelationId, RowExclusiveLock);
scan = systable_beginscan(rel, AccessMethodProcedureOidIndexId, true,
NULL, 1, skey);
/* we expect exactly one match */
tup = systable_getnext(scan);
if (!HeapTupleIsValid(tup))
elog(ERROR, "could not find tuple for amproc entry %u", entryOid);
CatalogTupleDelete(rel, &tup->t_self);
systable_endscan(scan);
table_close(rel, RowExclusiveLock);
}
/* /*
* Subroutine for ALTER OPERATOR CLASS SET SCHEMA/RENAME * Subroutine for ALTER OPERATOR CLASS SET SCHEMA/RENAME
* *
......
...@@ -218,28 +218,6 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) ...@@ -218,28 +218,6 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
return myself; return myself;
} }
/*
* Guts of language dropping.
*/
void
DropProceduralLanguageById(Oid langOid)
{
Relation rel;
HeapTuple langTup;
rel = table_open(LanguageRelationId, RowExclusiveLock);
langTup = SearchSysCache1(LANGOID, ObjectIdGetDatum(langOid));
if (!HeapTupleIsValid(langTup)) /* should not happen */
elog(ERROR, "cache lookup failed for language %u", langOid);
CatalogTupleDelete(rel, &langTup->t_self);
ReleaseSysCache(langTup);
table_close(rel, RowExclusiveLock);
}
/* /*
* get_language_oid - given a language name, look up the OID * get_language_oid - given a language name, look up the OID
* *
......
...@@ -468,29 +468,6 @@ AlterPublication(AlterPublicationStmt *stmt) ...@@ -468,29 +468,6 @@ AlterPublication(AlterPublicationStmt *stmt)
table_close(rel, RowExclusiveLock); table_close(rel, RowExclusiveLock);
} }
/*
* Drop publication by OID
*/
void
RemovePublicationById(Oid pubid)
{
Relation rel;
HeapTuple tup;
rel = table_open(PublicationRelationId, RowExclusiveLock);
tup = SearchSysCache1(PUBLICATIONOID, ObjectIdGetDatum(pubid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for publication %u", pubid);
CatalogTupleDelete(rel, &tup->t_self);
ReleaseSysCache(tup);
table_close(rel, RowExclusiveLock);
}
/* /*
* Remove relation from publication by mapping OID. * Remove relation from publication by mapping OID.
*/ */
......
...@@ -210,29 +210,6 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString, ...@@ -210,29 +210,6 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
return namespaceId; return namespaceId;
} }
/*
* Guts of schema deletion.
*/
void
RemoveSchemaById(Oid schemaOid)
{
Relation relation;
HeapTuple tup;
relation = table_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCache1(NAMESPACEOID,
ObjectIdGetDatum(schemaOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for namespace %u", schemaOid);
CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup);
table_close(relation, RowExclusiveLock);
}
/* /*
* Rename schema * Rename schema
......
...@@ -291,29 +291,6 @@ DefineTSParser(List *names, List *parameters) ...@@ -291,29 +291,6 @@ DefineTSParser(List *names, List *parameters)
return address; return address;
} }
/*
* Guts of TS parser deletion.
*/
void
RemoveTSParserById(Oid prsId)
{
Relation relation;
HeapTuple tup;
relation = table_open(TSParserRelationId, RowExclusiveLock);
tup = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search parser %u", prsId);
CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup);
table_close(relation, RowExclusiveLock);
}
/* ---------------------- TS Dictionary commands -----------------------*/ /* ---------------------- TS Dictionary commands -----------------------*/
/* /*
...@@ -504,30 +481,6 @@ DefineTSDictionary(List *names, List *parameters) ...@@ -504,30 +481,6 @@ DefineTSDictionary(List *names, List *parameters)
return address; return address;
} }
/*
* Guts of TS dictionary deletion.
*/
void
RemoveTSDictionaryById(Oid dictId)
{
Relation relation;
HeapTuple tup;
relation = table_open(TSDictionaryRelationId, RowExclusiveLock);
tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search dictionary %u",
dictId);
CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup);
table_close(relation, RowExclusiveLock);
}
/* /*
* ALTER TEXT SEARCH DICTIONARY * ALTER TEXT SEARCH DICTIONARY
*/ */
...@@ -820,30 +773,6 @@ DefineTSTemplate(List *names, List *parameters) ...@@ -820,30 +773,6 @@ DefineTSTemplate(List *names, List *parameters)
return address; return address;
} }
/*
* Guts of TS template deletion.
*/
void
RemoveTSTemplateById(Oid tmplId)
{
Relation relation;
HeapTuple tup;
relation = table_open(TSTemplateRelationId, RowExclusiveLock);
tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for text search template %u",
tmplId);
CatalogTupleDelete(relation, &tup->t_self);
ReleaseSysCache(tup);
table_close(relation, RowExclusiveLock);
}
/* ---------------------- TS Configuration commands -----------------------*/ /* ---------------------- TS Configuration commands -----------------------*/
/* /*
......
...@@ -55,6 +55,7 @@ extern void check_object_ownership(Oid roleid, ...@@ -55,6 +55,7 @@ extern void check_object_ownership(Oid roleid,
extern Oid get_object_namespace(const ObjectAddress *address); extern Oid get_object_namespace(const ObjectAddress *address);
extern bool is_objectclass_supported(Oid class_id); extern bool is_objectclass_supported(Oid class_id);
extern const char *get_object_class_descr(Oid class_id);
extern Oid get_object_oid_index(Oid class_id); extern Oid get_object_oid_index(Oid class_id);
extern int get_object_catcache_oid(Oid class_id); extern int get_object_catcache_oid(Oid class_id);
extern int get_object_catcache_name(Oid class_id); extern int get_object_catcache_name(Oid class_id);
......
...@@ -68,6 +68,5 @@ extern Oid CollationCreate(const char *collname, Oid collnamespace, ...@@ -68,6 +68,5 @@ extern Oid CollationCreate(const char *collname, Oid collnamespace,
const char *collversion, const char *collversion,
bool if_not_exists, bool if_not_exists,
bool quiet); bool quiet);
extern void RemoveCollationById(Oid collationOid);
#endif /* PG_COLLATION_H */ #endif /* PG_COLLATION_H */
...@@ -65,7 +65,6 @@ extern ObjectAddress ConversionCreate(const char *conname, Oid connamespace, ...@@ -65,7 +65,6 @@ extern ObjectAddress ConversionCreate(const char *conname, Oid connamespace,
Oid conowner, Oid conowner,
int32 conforencoding, int32 contoencoding, int32 conforencoding, int32 contoencoding,
Oid conproc, bool def); Oid conproc, bool def);
extern void RemoveConversionById(Oid conversionOid);
extern Oid FindDefaultConversion(Oid connamespace, int32 for_encoding, extern Oid FindDefaultConversion(Oid connamespace, int32 for_encoding,
int32 to_encoding); int32 to_encoding);
......
...@@ -56,9 +56,7 @@ extern ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt ...@@ -56,9 +56,7 @@ extern ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt
extern void RemoveFunctionById(Oid funcOid); extern void RemoveFunctionById(Oid funcOid);
extern ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt); extern ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt);
extern ObjectAddress CreateCast(CreateCastStmt *stmt); extern ObjectAddress CreateCast(CreateCastStmt *stmt);
extern void DropCastById(Oid castOid);
extern ObjectAddress CreateTransform(CreateTransformStmt *stmt); extern ObjectAddress CreateTransform(CreateTransformStmt *stmt);
extern void DropTransformById(Oid transformOid);
extern void IsThereFunctionInNamespace(const char *proname, int pronargs, extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
oidvector *proargtypes, Oid nspOid); oidvector *proargtypes, Oid nspOid);
extern void ExecuteDoStmt(DoStmt *stmt, bool atomic); extern void ExecuteDoStmt(DoStmt *stmt, bool atomic);
...@@ -98,10 +96,6 @@ extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, ...@@ -98,10 +96,6 @@ extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args,
extern ObjectAddress DefineOpClass(CreateOpClassStmt *stmt); extern ObjectAddress DefineOpClass(CreateOpClassStmt *stmt);
extern ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt); extern ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt);
extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt); extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt);
extern void RemoveOpClassById(Oid opclassOid);
extern void RemoveOpFamilyById(Oid opfamilyOid);
extern void RemoveAmOpEntryById(Oid entryOid);
extern void RemoveAmProcEntryById(Oid entryOid);
extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod,
Oid opcnamespace); Oid opcnamespace);
extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod,
...@@ -111,14 +105,11 @@ extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok); ...@@ -111,14 +105,11 @@ extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
/* commands/tsearchcmds.c */ /* commands/tsearchcmds.c */
extern ObjectAddress DefineTSParser(List *names, List *parameters); extern ObjectAddress DefineTSParser(List *names, List *parameters);
extern void RemoveTSParserById(Oid prsId);
extern ObjectAddress DefineTSDictionary(List *names, List *parameters); extern ObjectAddress DefineTSDictionary(List *names, List *parameters);
extern void RemoveTSDictionaryById(Oid dictId);
extern ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt); extern ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt);
extern ObjectAddress DefineTSTemplate(List *names, List *parameters); extern ObjectAddress DefineTSTemplate(List *names, List *parameters);
extern void RemoveTSTemplateById(Oid tmplId);
extern ObjectAddress DefineTSConfiguration(List *names, List *parameters, extern ObjectAddress DefineTSConfiguration(List *names, List *parameters,
ObjectAddress *copied); ObjectAddress *copied);
...@@ -135,14 +126,11 @@ extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwner ...@@ -135,14 +126,11 @@ extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwner
extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId); extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId);
extern ObjectAddress CreateForeignDataWrapper(CreateFdwStmt *stmt); extern ObjectAddress CreateForeignDataWrapper(CreateFdwStmt *stmt);
extern ObjectAddress AlterForeignDataWrapper(AlterFdwStmt *stmt); extern ObjectAddress AlterForeignDataWrapper(AlterFdwStmt *stmt);
extern void RemoveForeignDataWrapperById(Oid fdwId);
extern ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt); extern ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt);
extern ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt); extern ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt);
extern void RemoveForeignServerById(Oid srvId);
extern ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt); extern ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt);
extern ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt); extern ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt);
extern Oid RemoveUserMapping(DropUserMappingStmt *stmt); extern Oid RemoveUserMapping(DropUserMappingStmt *stmt);
extern void RemoveUserMappingById(Oid umId);
extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid); extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid);
extern void ImportForeignSchema(ImportForeignSchemaStmt *stmt); extern void ImportForeignSchema(ImportForeignSchemaStmt *stmt);
extern Datum transformGenericOptions(Oid catalogId, extern Datum transformGenericOptions(Oid catalogId,
...@@ -152,7 +140,6 @@ extern Datum transformGenericOptions(Oid catalogId, ...@@ -152,7 +140,6 @@ extern Datum transformGenericOptions(Oid catalogId,
/* commands/amcmds.c */ /* commands/amcmds.c */
extern ObjectAddress CreateAccessMethod(CreateAmStmt *stmt); extern ObjectAddress CreateAccessMethod(CreateAmStmt *stmt);
extern void RemoveAccessMethodById(Oid amOid);
extern Oid get_index_am_oid(const char *amname, bool missing_ok); extern Oid get_index_am_oid(const char *amname, bool missing_ok);
extern Oid get_table_am_oid(const char *amname, bool missing_ok); extern Oid get_table_am_oid(const char *amname, bool missing_ok);
extern Oid get_am_oid(const char *amname, bool missing_ok); extern Oid get_am_oid(const char *amname, bool missing_ok);
......
...@@ -41,7 +41,6 @@ typedef struct EventTriggerData ...@@ -41,7 +41,6 @@ typedef struct EventTriggerData
((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData)) ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData))
extern Oid CreateEventTrigger(CreateEventTrigStmt *stmt); extern Oid CreateEventTrigger(CreateEventTrigStmt *stmt);
extern void RemoveEventTriggerById(Oid trigOid);
extern Oid get_event_trigger_oid(const char *trigname, bool missing_ok); extern Oid get_event_trigger_oid(const char *trigname, bool missing_ok);
extern Oid AlterEventTrigger(AlterEventTrigStmt *stmt); extern Oid AlterEventTrigger(AlterEventTrigStmt *stmt);
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "nodes/parsenodes.h" #include "nodes/parsenodes.h"
extern ObjectAddress CreateProceduralLanguage(CreatePLangStmt *stmt); extern ObjectAddress CreateProceduralLanguage(CreatePLangStmt *stmt);
extern void DropProceduralLanguageById(Oid langOid);
extern Oid get_language_oid(const char *langname, bool missing_ok); extern Oid get_language_oid(const char *langname, bool missing_ok);
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt); extern ObjectAddress CreatePublication(CreatePublicationStmt *stmt);
extern void AlterPublication(AlterPublicationStmt *stmt); extern void AlterPublication(AlterPublicationStmt *stmt);
extern void RemovePublicationById(Oid pubid);
extern void RemovePublicationRelById(Oid proid); extern void RemovePublicationRelById(Oid proid);
extern ObjectAddress AlterPublicationOwner(const char *name, Oid newOwnerId); extern ObjectAddress AlterPublicationOwner(const char *name, Oid newOwnerId);
......
...@@ -22,8 +22,6 @@ extern Oid CreateSchemaCommand(CreateSchemaStmt *parsetree, ...@@ -22,8 +22,6 @@ extern Oid CreateSchemaCommand(CreateSchemaStmt *parsetree,
const char *queryString, const char *queryString,
int stmt_location, int stmt_len); int stmt_location, int stmt_len);
extern void RemoveSchemaById(Oid schemaOid);
extern ObjectAddress RenameSchema(const char *oldname, const char *newname); extern ObjectAddress RenameSchema(const char *oldname, const char *newname);
extern ObjectAddress AlterSchemaOwner(const char *name, Oid newOwnerId); extern ObjectAddress AlterSchemaOwner(const char *name, Oid newOwnerId);
extern void AlterSchemaOwner_oid(Oid schemaOid, Oid newOwnerId); extern void AlterSchemaOwner_oid(Oid schemaOid, Oid newOwnerId);
......
...@@ -230,7 +230,6 @@ extern void ExecuteGrantStmt(GrantStmt *stmt); ...@@ -230,7 +230,6 @@ extern void ExecuteGrantStmt(GrantStmt *stmt);
extern void ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *stmt); extern void ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *stmt);
extern void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid); extern void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid);
extern void RemoveDefaultACLById(Oid defaclOid);
extern AclMode pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, extern AclMode pg_attribute_aclmask(Oid table_oid, AttrNumber attnum,
Oid roleid, AclMode mask, AclMaskHow how); Oid roleid, AclMode mask, AclMaskHow how);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment