From: Robert Haas Date: Sun, 23 Dec 2012 23:25:03 +0000 (-0500) Subject: Adjust many backend functions to return OID rather than void. X-Git-Tag: REL9_3_BETA1~566 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c504513f83a9ee8;p=postgresql Adjust many backend functions to return OID rather than void. Extracted from a larger patch by Dimitri Fontaine. It is hoped that this will provide infrastructure for enriching the new event trigger functionality, but it seems possibly useful for other purposes as well. --- diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c index 2e12c5a3d5..c9449f81e1 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -42,7 +42,7 @@ static Oid lookup_agg_function(List *fnName, int nargs, Oid *input_types, /* * AggregateCreate */ -void +Oid AggregateCreate(const char *aggName, Oid aggNamespace, Oid *aggArgTypes, @@ -316,6 +316,8 @@ AggregateCreate(const char *aggName, referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); } + + return procOid; } /* diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c index 88af345fab..47830dc3e6 100644 --- a/src/backend/catalog/pg_operator.c +++ b/src/backend/catalog/pg_operator.c @@ -326,7 +326,7 @@ OperatorShellMake(const char *operatorName, * Forward declaration is used only for this purpose, it is * not available to the user as it is for type definition. */ -void +Oid OperatorCreate(const char *operatorName, Oid operatorNamespace, Oid leftTypeId, @@ -565,6 +565,8 @@ OperatorCreate(const char *operatorName, if (OidIsValid(commutatorId) || OidIsValid(negatorId)) OperatorUpd(operatorObjectId, commutatorId, negatorId); + + return operatorObjectId; } /* diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c index b9f871182f..67a29d19fc 100644 --- a/src/backend/commands/aggregatecmds.c +++ b/src/backend/commands/aggregatecmds.c @@ -46,7 +46,7 @@ * is specified by a BASETYPE element in the parameters. Otherwise, * "args" defines the input type(s). */ -void +Oid DefineAggregate(List *name, List *args, bool oldstyle, List *parameters) { char *aggName; @@ -216,15 +216,15 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters) /* * Most of the argument-checking is done inside of AggregateCreate */ - AggregateCreate(aggName, /* aggregate name */ - aggNamespace, /* namespace */ - aggArgTypes, /* input data type(s) */ - numArgs, - transfuncName, /* step function name */ - finalfuncName, /* final function name */ - sortoperatorName, /* sort operator name */ - transTypeId, /* transition data type */ - initval); /* initial condition */ + return AggregateCreate(aggName, /* aggregate name */ + aggNamespace, /* namespace */ + aggArgTypes, /* input data type(s) */ + numArgs, + transfuncName, /* step function name */ + finalfuncName, /* final function name */ + sortoperatorName, /* sort operator name */ + transTypeId, /* transition data type */ + initval); /* initial condition */ } @@ -232,7 +232,7 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters) * RenameAggregate * Rename an aggregate. */ -void +Oid RenameAggregate(List *name, List *args, const char *newname) { Oid procOid; @@ -286,4 +286,6 @@ RenameAggregate(List *name, List *args, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return procOid; } diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index 9e271c3e59..d8555ed4c7 100644 --- a/src/backend/commands/alter.c +++ b/src/backend/commands/alter.c @@ -50,112 +50,90 @@ * Executes an ALTER OBJECT / RENAME TO statement. Based on the object * type, the function appropriate to that type is executed. */ -void +Oid ExecRenameStmt(RenameStmt *stmt) { switch (stmt->renameType) { case OBJECT_AGGREGATE: - RenameAggregate(stmt->object, stmt->objarg, stmt->newname); - break; + return RenameAggregate(stmt->object, stmt->objarg, stmt->newname); case OBJECT_COLLATION: - RenameCollation(stmt->object, stmt->newname); - break; + return RenameCollation(stmt->object, stmt->newname); case OBJECT_CONSTRAINT: - RenameConstraint(stmt); - break; + return RenameConstraint(stmt); case OBJECT_CONVERSION: - RenameConversion(stmt->object, stmt->newname); - break; + return RenameConversion(stmt->object, stmt->newname); case OBJECT_DATABASE: - RenameDatabase(stmt->subname, stmt->newname); - break; + return RenameDatabase(stmt->subname, stmt->newname); case OBJECT_FDW: - RenameForeignDataWrapper(stmt->subname, stmt->newname); - break; + return RenameForeignDataWrapper(stmt->subname, stmt->newname); case OBJECT_FOREIGN_SERVER: - RenameForeignServer(stmt->subname, stmt->newname); - break; + return RenameForeignServer(stmt->subname, stmt->newname); case OBJECT_EVENT_TRIGGER: - RenameEventTrigger(stmt->subname, stmt->newname); - break; + return RenameEventTrigger(stmt->subname, stmt->newname); case OBJECT_FUNCTION: - RenameFunction(stmt->object, stmt->objarg, stmt->newname); - break; + return RenameFunction(stmt->object, stmt->objarg, stmt->newname); case OBJECT_LANGUAGE: - RenameLanguage(stmt->subname, stmt->newname); - break; + return RenameLanguage(stmt->subname, stmt->newname); case OBJECT_OPCLASS: - RenameOpClass(stmt->object, stmt->subname, stmt->newname); - break; + return RenameOpClass(stmt->object, stmt->subname, stmt->newname); case OBJECT_OPFAMILY: - RenameOpFamily(stmt->object, stmt->subname, stmt->newname); - break; + return RenameOpFamily(stmt->object, stmt->subname, stmt->newname); case OBJECT_ROLE: - RenameRole(stmt->subname, stmt->newname); - break; + return RenameRole(stmt->subname, stmt->newname); case OBJECT_SCHEMA: - RenameSchema(stmt->subname, stmt->newname); - break; + return RenameSchema(stmt->subname, stmt->newname); case OBJECT_TABLESPACE: - RenameTableSpace(stmt->subname, stmt->newname); - break; + return RenameTableSpace(stmt->subname, stmt->newname); case OBJECT_TABLE: case OBJECT_SEQUENCE: case OBJECT_VIEW: case OBJECT_INDEX: case OBJECT_FOREIGN_TABLE: - RenameRelation(stmt); - break; + return RenameRelation(stmt); case OBJECT_COLUMN: case OBJECT_ATTRIBUTE: - renameatt(stmt); - break; + return renameatt(stmt); case OBJECT_TRIGGER: - renametrig(stmt); - break; + return renametrig(stmt); case OBJECT_TSPARSER: - RenameTSParser(stmt->object, stmt->newname); - break; + return RenameTSParser(stmt->object, stmt->newname); case OBJECT_TSDICTIONARY: - RenameTSDictionary(stmt->object, stmt->newname); - break; + return RenameTSDictionary(stmt->object, stmt->newname); case OBJECT_TSTEMPLATE: - RenameTSTemplate(stmt->object, stmt->newname); - break; + return RenameTSTemplate(stmt->object, stmt->newname); case OBJECT_TSCONFIGURATION: - RenameTSConfiguration(stmt->object, stmt->newname); - break; + return RenameTSConfiguration(stmt->object, stmt->newname); case OBJECT_DOMAIN: case OBJECT_TYPE: - RenameType(stmt); - break; + return RenameType(stmt); default: elog(ERROR, "unrecognized rename stmt type: %d", (int) stmt->renameType); + return InvalidOid; /* keep compiler happy */ } } @@ -163,40 +141,35 @@ ExecRenameStmt(RenameStmt *stmt) * Executes an ALTER OBJECT / SET SCHEMA statement. Based on the object * type, the function appropriate to that type is executed. */ -void +Oid ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt) { switch (stmt->objectType) { case OBJECT_AGGREGATE: - AlterFunctionNamespace(stmt->object, stmt->objarg, true, - stmt->newschema); - break; + return AlterFunctionNamespace(stmt->object, stmt->objarg, true, + stmt->newschema); case OBJECT_COLLATION: - AlterCollationNamespace(stmt->object, stmt->newschema); - break; + return AlterCollationNamespace(stmt->object, stmt->newschema); case OBJECT_EXTENSION: - AlterExtensionNamespace(stmt->object, stmt->newschema); - break; + return AlterExtensionNamespace(stmt->object, stmt->newschema); case OBJECT_FUNCTION: - AlterFunctionNamespace(stmt->object, stmt->objarg, false, - stmt->newschema); - break; + return AlterFunctionNamespace(stmt->object, stmt->objarg, false, + stmt->newschema); case OBJECT_SEQUENCE: case OBJECT_TABLE: case OBJECT_VIEW: case OBJECT_FOREIGN_TABLE: - AlterTableNamespace(stmt); - break; + return AlterTableNamespace(stmt); case OBJECT_TYPE: case OBJECT_DOMAIN: - AlterTypeNamespace(stmt->object, stmt->newschema, stmt->objectType); - break; + return AlterTypeNamespace(stmt->object, stmt->newschema, + stmt->objectType); /* generic code path */ case OBJECT_CONVERSION: @@ -228,12 +201,15 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt) AlterObjectNamespace_internal(catalog, address.objectId, nspOid); heap_close(catalog, RowExclusiveLock); + + return address.objectId; } break; default: elog(ERROR, "unrecognized AlterObjectSchemaStmt type: %d", (int) stmt->objectType); + return InvalidOid; /* keep compiler happy */ } } @@ -435,7 +411,7 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid) * Executes an ALTER OBJECT / OWNER TO statement. Based on the object * type, the function appropriate to that type is executed. */ -void +Oid ExecAlterOwnerStmt(AlterOwnerStmt *stmt) { Oid newowner = get_role_oid(stmt->newowner, false); @@ -443,30 +419,27 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) switch (stmt->objectType) { case OBJECT_DATABASE: - AlterDatabaseOwner(strVal(linitial(stmt->object)), newowner); - break; + return AlterDatabaseOwner(strVal(linitial(stmt->object)), newowner); case OBJECT_SCHEMA: - AlterSchemaOwner(strVal(linitial(stmt->object)), newowner); - break; + return AlterSchemaOwner(strVal(linitial(stmt->object)), newowner); case OBJECT_TYPE: case OBJECT_DOMAIN: /* same as TYPE */ - AlterTypeOwner(stmt->object, newowner, stmt->objectType); + return AlterTypeOwner(stmt->object, newowner, stmt->objectType); break; case OBJECT_FDW: - AlterForeignDataWrapperOwner(strVal(linitial(stmt->object)), - newowner); - break; + return AlterForeignDataWrapperOwner(strVal(linitial(stmt->object)), + newowner); case OBJECT_FOREIGN_SERVER: - AlterForeignServerOwner(strVal(linitial(stmt->object)), newowner); - break; + return AlterForeignServerOwner(strVal(linitial(stmt->object)), + newowner); case OBJECT_EVENT_TRIGGER: - AlterEventTriggerOwner(strVal(linitial(stmt->object)), newowner); - break; + return AlterEventTriggerOwner(strVal(linitial(stmt->object)), + newowner); /* Generic cases */ case OBJECT_AGGREGATE: @@ -508,12 +481,16 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) AlterObjectOwner_internal(catalog, address.objectId, newowner); heap_close(catalog, RowExclusiveLock); + + return address.objectId; } break; default: elog(ERROR, "unrecognized AlterOwnerStmt type: %d", (int) stmt->objectType); + + return InvalidOid; /* keep compiler happy */ } } diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c index ec22d11293..9fbb223f3f 100644 --- a/src/backend/commands/collationcmds.c +++ b/src/backend/commands/collationcmds.c @@ -37,7 +37,7 @@ /* * CREATE COLLATION */ -void +Oid DefineCollation(List *names, List *parameters) { char *collName; @@ -140,12 +140,14 @@ DefineCollation(List *names, List *parameters) /* check that the locales can be loaded */ CommandCounterIncrement(); (void) pg_newlocale_from_collation(newoid); + + return newoid; } /* * Rename collation */ -void +Oid RenameCollation(List *name, const char *newname) { Oid collationOid; @@ -206,12 +208,14 @@ RenameCollation(List *name, const char *newname) heap_freetuple(tup); heap_close(rel, RowExclusiveLock); + + return collationOid; } /* * Execute ALTER COLLATION SET SCHEMA */ -void +Oid AlterCollationNamespace(List *name, const char *newschema) { Oid collOid, @@ -222,6 +226,8 @@ AlterCollationNamespace(List *name, const char *newschema) nspOid = LookupCreationNamespace(newschema); AlterCollationNamespace_oid(collOid, nspOid); + + return collOid; } /* diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c index 3a71e334ce..3a28772397 100644 --- a/src/backend/commands/conversioncmds.c +++ b/src/backend/commands/conversioncmds.c @@ -34,7 +34,7 @@ /* * CREATE CONVERSION */ -void +Oid CreateConversionCommand(CreateConversionStmt *stmt) { Oid namespaceId; @@ -111,14 +111,14 @@ CreateConversionCommand(CreateConversionStmt *stmt) * All seem ok, go ahead (possible failure would be a duplicate conversion * name) */ - ConversionCreate(conversion_name, namespaceId, GetUserId(), - from_encoding, to_encoding, funcoid, stmt->def); + return ConversionCreate(conversion_name, namespaceId, GetUserId(), + from_encoding, to_encoding, funcoid, stmt->def); } /* * Rename conversion */ -void +Oid RenameConversion(List *name, const char *newname) { Oid conversionOid; @@ -164,4 +164,6 @@ RenameConversion(List *name, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return conversionOid; } diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 3c13c470fd..c390575f42 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -900,7 +900,7 @@ dropdb(const char *dbname, bool missing_ok) /* * Rename database */ -void +Oid RenameDatabase(const char *oldname, const char *newname) { Oid db_id; @@ -977,6 +977,8 @@ RenameDatabase(const char *oldname, const char *newname) * Close pg_database, but keep lock till commit. */ heap_close(rel, NoLock); + + return db_id; } @@ -1436,9 +1438,10 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) /* * ALTER DATABASE name OWNER TO newowner */ -void +Oid AlterDatabaseOwner(const char *dbname, Oid newOwnerId) { + Oid db_id; HeapTuple tuple; Relation rel; ScanKeyData scankey; @@ -1463,6 +1466,7 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId) (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); + db_id = HeapTupleGetOid(tuple); datForm = (Form_pg_database) GETSTRUCT(tuple); /* @@ -1539,6 +1543,8 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId) /* Close pg_database, but keep lock till commit */ heap_close(rel, NoLock); + + return db_id; } diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c index 1edffee410..722c3cf118 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -413,9 +413,10 @@ AlterEventTrigger(AlterEventTrigStmt *stmt) /* * Rename event trigger */ -void +Oid RenameEventTrigger(const char *trigname, const char *newname) { + Oid evtId; HeapTuple tup; Relation rel; Form_pg_event_trigger evtForm; @@ -438,6 +439,8 @@ RenameEventTrigger(const char *trigname, const char *newname) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_EVENT_TRIGGER, trigname); + evtId = HeapTupleGetOid(tup); + evtForm = (Form_pg_event_trigger) GETSTRUCT(tup); /* tuple is a copy, so we can rename it now */ @@ -447,15 +450,18 @@ RenameEventTrigger(const char *trigname, const char *newname) heap_freetuple(tup); heap_close(rel, RowExclusiveLock); + + return evtId; } /* * Change event trigger's owner -- by name */ -void +Oid AlterEventTriggerOwner(const char *name, Oid newOwnerId) { + Oid evtOid; HeapTuple tup; Relation rel; @@ -468,11 +474,15 @@ AlterEventTriggerOwner(const char *name, Oid newOwnerId) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("event trigger \"%s\" does not exist", name))); + evtOid = HeapTupleGetOid(tup); + AlterEventTriggerOwner_internal(rel, tup, newOwnerId); heap_freetuple(tup); heap_close(rel, RowExclusiveLock); + + return evtOid; } /* diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index 3b8e22425c..ad072a5c7b 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -1174,7 +1174,7 @@ find_update_path(List *evi_list, /* * CREATE EXTENSION */ -void +Oid CreateExtension(CreateExtensionStmt *stmt) { DefElem *d_schema = NULL; @@ -1210,7 +1210,7 @@ CreateExtension(CreateExtensionStmt *stmt) (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("extension \"%s\" already exists, skipping", stmt->extname))); - return; + return InvalidOid; } else ereport(ERROR, @@ -1470,6 +1470,8 @@ CreateExtension(CreateExtensionStmt *stmt) */ ApplyExtensionUpdates(extensionOid, pcontrol, versionName, updateVersions); + + return extensionOid; } /* @@ -2398,7 +2400,7 @@ extension_config_remove(Oid extensionoid, Oid tableoid) /* * Execute ALTER EXTENSION SET SCHEMA */ -void +Oid AlterExtensionNamespace(List *names, const char *newschema) { char *extensionName; @@ -2479,7 +2481,7 @@ AlterExtensionNamespace(List *names, const char *newschema) if (extForm->extnamespace == nspOid) { heap_close(extRel, RowExclusiveLock); - return; + return InvalidOid; } /* Check extension is supposed to be relocatable */ @@ -2571,6 +2573,8 @@ AlterExtensionNamespace(List *names, const char *newschema) /* update dependencies to point to the new schema */ changeDependencyFor(ExtensionRelationId, extensionOid, NamespaceRelationId, oldNspOid, nspOid); + + return extensionOid; } /* diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c index f10cb5252d..af833b886b 100644 --- a/src/backend/commands/foreigncmds.c +++ b/src/backend/commands/foreigncmds.c @@ -204,9 +204,10 @@ GetUserOidFromMapping(const char *username, bool missing_ok) /* * Rename foreign-data wrapper */ -void +Oid RenameForeignDataWrapper(const char *oldname, const char *newname) { + Oid fdwId; HeapTuple tup; Relation rel; @@ -218,6 +219,8 @@ RenameForeignDataWrapper(const char *oldname, const char *newname) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("foreign-data wrapper \"%s\" does not exist", oldname))); + fdwId = HeapTupleGetOid(tup); + /* make sure the new name doesn't exist */ if (SearchSysCacheExists1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(newname))) ereport(ERROR, @@ -236,15 +239,18 @@ RenameForeignDataWrapper(const char *oldname, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return fdwId; } /* * Rename foreign server */ -void +Oid RenameForeignServer(const char *oldname, const char *newname) { + Oid srvId; HeapTuple tup; Relation rel; @@ -256,6 +262,8 @@ RenameForeignServer(const char *oldname, const char *newname) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("server \"%s\" does not exist", oldname))); + srvId = HeapTupleGetOid(tup); + /* make sure the new name doesn't exist */ if (SearchSysCacheExists1(FOREIGNSERVERNAME, CStringGetDatum(newname))) ereport(ERROR, @@ -274,6 +282,8 @@ RenameForeignServer(const char *oldname, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return srvId; } @@ -325,9 +335,10 @@ AlterForeignDataWrapperOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerI * * Note restrictions in the "_internal" function, above. */ -void +Oid AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId) { + Oid fdwId; HeapTuple tup; Relation rel; @@ -340,11 +351,15 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("foreign-data wrapper \"%s\" does not exist", name))); + fdwId = HeapTupleGetOid(tup); + AlterForeignDataWrapperOwner_internal(rel, tup, newOwnerId); heap_freetuple(tup); heap_close(rel, RowExclusiveLock); + + return fdwId; } /* @@ -426,9 +441,10 @@ AlterForeignServerOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) /* * Change foreign server owner -- by name */ -void +Oid AlterForeignServerOwner(const char *name, Oid newOwnerId) { + Oid servOid; HeapTuple tup; Relation rel; @@ -441,11 +457,15 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("server \"%s\" does not exist", name))); + servOid = HeapTupleGetOid(tup); + AlterForeignServerOwner_internal(rel, tup, newOwnerId); heap_freetuple(tup); heap_close(rel, RowExclusiveLock); + + return servOid; } /* diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 453e33ae66..2c36ce0e0f 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -784,7 +784,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName, * CreateFunction * Execute a CREATE FUNCTION utility statement. */ -void +Oid CreateFunction(CreateFunctionStmt *stmt, const char *queryString) { char *probin_str; @@ -960,30 +960,30 @@ CreateFunction(CreateFunctionStmt *stmt, const char *queryString) * And now that we have all the parameters, and know we're permitted to do * so, go ahead and create the function. */ - ProcedureCreate(funcname, - namespaceId, - stmt->replace, - returnsSet, - prorettype, - GetUserId(), - languageOid, - languageValidator, - prosrc_str, /* converted to text later */ - probin_str, /* converted to text later */ - false, /* not an aggregate */ - isWindowFunc, - security, - isLeakProof, - isStrict, - volatility, - parameterTypes, - PointerGetDatum(allParameterTypes), - PointerGetDatum(parameterModes), - PointerGetDatum(parameterNames), - parameterDefaults, - PointerGetDatum(proconfig), - procost, - prorows); + return ProcedureCreate(funcname, + namespaceId, + stmt->replace, + returnsSet, + prorettype, + GetUserId(), + languageOid, + languageValidator, + prosrc_str, /* converted to text later */ + probin_str, /* converted to text later */ + false, /* not an aggregate */ + isWindowFunc, + security, + isLeakProof, + isStrict, + volatility, + parameterTypes, + PointerGetDatum(allParameterTypes), + PointerGetDatum(parameterModes), + PointerGetDatum(parameterNames), + parameterDefaults, + PointerGetDatum(proconfig), + procost, + prorows); } @@ -1040,7 +1040,7 @@ RemoveFunctionById(Oid funcOid) /* * Rename function */ -void +Oid RenameFunction(List *name, List *argtypes, const char *newname) { Oid procOid; @@ -1102,6 +1102,8 @@ RenameFunction(List *name, List *argtypes, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return procOid; } /* @@ -1686,7 +1688,7 @@ DropCastById(Oid castOid) * * These commands are identical except for the lookup procedure, so share code. */ -void +Oid AlterFunctionNamespace(List *name, List *argtypes, bool isagg, const char *newschema) { @@ -1703,6 +1705,8 @@ AlterFunctionNamespace(List *name, List *argtypes, bool isagg, nspOid = LookupCreationNamespace(newschema); AlterFunctionNamespace_oid(procOid, nspOid); + + return procOid; } Oid diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index 099bb39139..b85f1cb640 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -1660,7 +1660,7 @@ RemoveAmProcEntryById(Oid entryOid) /* * Rename opclass */ -void +Oid RenameOpClass(List *name, const char *access_method, const char *newname) { Oid opcOid; @@ -1713,12 +1713,14 @@ RenameOpClass(List *name, const char *access_method, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return opcOid; } /* * Rename opfamily */ -void +Oid RenameOpFamily(List *name, const char *access_method, const char *newname) { Oid opfOid; @@ -1802,6 +1804,8 @@ RenameOpFamily(List *name, const char *access_method, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return opfOid; } /* diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index f31bf36e9b..10666a9ef4 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -59,7 +59,7 @@ * * 'parameters' is a list of DefElem */ -void +Oid DefineOperator(List *names, List *parameters) { char *oprName; @@ -295,20 +295,20 @@ DefineOperator(List *names, List *parameters) /* * now have OperatorCreate do all the work.. */ - OperatorCreate(oprName, /* operator name */ - oprNamespace, /* namespace */ - typeId1, /* left type id */ - typeId2, /* right type id */ - functionOid, /* function for operator */ - commutatorName, /* optional commutator operator name */ - negatorName, /* optional negator operator name */ - restrictionOid, /* optional restrict. sel. procedure */ - joinOid, /* optional join sel. procedure name */ - canMerge, /* operator merges */ - canHash); /* operator hashes */ + return + OperatorCreate(oprName, /* operator name */ + oprNamespace, /* namespace */ + typeId1, /* left type id */ + typeId2, /* right type id */ + functionOid, /* function for operator */ + commutatorName, /* optional commutator operator name */ + negatorName, /* optional negator operator name */ + restrictionOid, /* optional restrict. sel. procedure */ + joinOid, /* optional join sel. procedure name */ + canMerge, /* operator merges */ + canHash); /* operator hashes */ } - /* * Guts of operator deletion. */ diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index ee860c0e1a..93283b1a84 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -537,9 +537,10 @@ DropProceduralLanguageById(Oid langOid) /* * Rename language */ -void +Oid RenameLanguage(const char *oldname, const char *newname) { + Oid lanId; HeapTuple tup; Relation rel; @@ -551,6 +552,8 @@ RenameLanguage(const char *oldname, const char *newname) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("language \"%s\" does not exist", oldname))); + lanId = HeapTupleGetOid(tup); + /* make sure the new name doesn't exist */ if (SearchSysCacheExists1(LANGNAME, CStringGetDatum(newname))) ereport(ERROR, @@ -569,6 +572,8 @@ RenameLanguage(const char *oldname, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return lanId; } /* diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index e69c86bbab..4aff37fffd 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -38,7 +38,7 @@ static void AlterSchemaOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerI /* * CREATE SCHEMA */ -void +Oid CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString) { const char *schemaName = stmt->schemaname; @@ -97,7 +97,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString) (errcode(ERRCODE_DUPLICATE_SCHEMA), errmsg("schema \"%s\" already exists, skipping", schemaName))); - return; + return InvalidOid; } /* @@ -163,6 +163,8 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString) /* Reset current user and security context */ SetUserIdAndSecContext(saved_uid, save_sec_context); + + return namespaceId; } /* @@ -192,9 +194,10 @@ RemoveSchemaById(Oid schemaOid) /* * Rename schema */ -void +Oid RenameSchema(const char *oldname, const char *newname) { + Oid nspOid; HeapTuple tup; Relation rel; AclResult aclresult; @@ -207,6 +210,8 @@ RenameSchema(const char *oldname, const char *newname) (errcode(ERRCODE_UNDEFINED_SCHEMA), errmsg("schema \"%s\" does not exist", oldname))); + nspOid = HeapTupleGetOid(tup); + /* make sure the new name doesn't exist */ if (OidIsValid(get_namespace_oid(newname, true))) ereport(ERROR, @@ -237,6 +242,8 @@ RenameSchema(const char *oldname, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return nspOid; } void @@ -262,9 +269,10 @@ AlterSchemaOwner_oid(Oid oid, Oid newOwnerId) /* * Change schema owner */ -void +Oid AlterSchemaOwner(const char *name, Oid newOwnerId) { + Oid nspOid; HeapTuple tup; Relation rel; @@ -276,11 +284,15 @@ AlterSchemaOwner(const char *name, Oid newOwnerId) (errcode(ERRCODE_UNDEFINED_SCHEMA), errmsg("schema \"%s\" does not exist", name))); + nspOid = HeapTupleGetOid(tup); + AlterSchemaOwner_internal(tup, rel, newOwnerId); ReleaseSysCache(tup); heap_close(rel, RowExclusiveLock); + + return nspOid; } static void diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 5583e721ea..585b5b2bed 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -103,7 +103,7 @@ static void process_owned_by(Relation seqrel, List *owned_by); * DefineSequence * Creates a new sequence relation */ -void +Oid DefineSequence(CreateSeqStmt *seq) { FormData_pg_sequence new; @@ -228,6 +228,8 @@ DefineSequence(CreateSeqStmt *seq) process_owned_by(rel, owned_by); heap_close(rel, NoLock); + + return seqoid; } /* @@ -400,7 +402,7 @@ fill_seq_with_data(Relation rel, HeapTuple tuple) * * Modify the definition of a sequence relation */ -void +Oid AlterSequence(AlterSeqStmt *stmt) { Oid relid; @@ -419,7 +421,7 @@ AlterSequence(AlterSeqStmt *stmt) ereport(NOTICE, (errmsg("relation \"%s\" does not exist, skipping", stmt->sequence->relname))); - return; + return InvalidOid; } init_sequence(relid, &elm, &seqrel); @@ -483,6 +485,8 @@ AlterSequence(AlterSeqStmt *stmt) process_owned_by(seqrel, owned_by); relation_close(seqrel, NoLock); + + return relid; } diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 761374741d..adbaa2975e 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -2098,7 +2098,7 @@ renameatt_internal(Oid myrelid, Relation targetrelation; Relation attrelation; HeapTuple atttup; - Form_pg_attribute attform; + Form_pg_attribute attform; int attnum; /* @@ -2248,7 +2248,7 @@ RangeVarCallbackForRenameAttribute(const RangeVar *rv, Oid relid, Oid oldrelid, /* * renameatt - changes the name of a attribute in a relation */ -void +Oid renameatt(RenameStmt *stmt) { Oid relid; @@ -2264,7 +2264,7 @@ renameatt(RenameStmt *stmt) ereport(NOTICE, (errmsg("relation \"%s\" does not exist, skipping", stmt->relation->relname))); - return; + return InvalidOid; } renameatt_internal(relid, @@ -2274,13 +2274,16 @@ renameatt(RenameStmt *stmt) false, /* recursing? */ 0, /* expected inhcount */ stmt->behavior); + + /* This is an ALTER TABLE command so it's about the relid */ + return relid; } /* * same logic as renameatt_internal */ -static void +static Oid rename_constraint_internal(Oid myrelid, Oid mytypid, const char *oldconname, @@ -2372,9 +2375,11 @@ rename_constraint_internal(Oid myrelid, if (targetrelation) relation_close(targetrelation, NoLock); /* close rel but keep lock */ + + return constraintOid; } -void +Oid RenameConstraint(RenameStmt *stmt) { Oid relid = InvalidOid; @@ -2403,18 +2408,20 @@ RenameConstraint(RenameStmt *stmt) NULL); } - rename_constraint_internal(relid, typid, - stmt->subname, - stmt->newname, - stmt->relation ? interpretInhOption(stmt->relation->inhOpt) : false, /* recursive? */ - false, /* recursing? */ - 0 /* expected inhcount */ ); + return + rename_constraint_internal(relid, typid, + stmt->subname, + stmt->newname, + stmt->relation ? interpretInhOption(stmt->relation->inhOpt) : false, /* recursive? */ + false, /* recursing? */ + 0 /* expected inhcount */ ); + } /* * Execute ALTER TABLE/INDEX/SEQUENCE/VIEW/FOREIGN TABLE RENAME */ -void +Oid RenameRelation(RenameStmt *stmt) { Oid relid; @@ -2436,11 +2443,13 @@ RenameRelation(RenameStmt *stmt) ereport(NOTICE, (errmsg("relation \"%s\" does not exist, skipping", stmt->relation->relname))); - return; + return InvalidOid; } /* Do the work */ RenameRelationInternal(relid, stmt->newname); + + return relid; } /* @@ -9746,7 +9755,7 @@ ATExecGenericOptions(Relation rel, List *options) /* * Execute ALTER TABLE SET SCHEMA */ -void +Oid AlterTableNamespace(AlterObjectSchemaStmt *stmt) { Relation rel; @@ -9766,7 +9775,7 @@ AlterTableNamespace(AlterObjectSchemaStmt *stmt) ereport(NOTICE, (errmsg("relation \"%s\" does not exist, skipping", stmt->relation->relname))); - return; + return InvalidOid; } rel = relation_open(relid, NoLock); @@ -9801,6 +9810,8 @@ AlterTableNamespace(AlterObjectSchemaStmt *stmt) /* close rel, but keep lock until commit */ relation_close(rel, NoLock); + + return relid; } /* diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index 5081d8411e..2c19db31e0 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -818,9 +818,10 @@ directory_is_empty(const char *path) /* * Rename a tablespace */ -void +Oid RenameTableSpace(const char *oldname, const char *newname) { + Oid tspId; Relation rel; ScanKeyData entry[1]; HeapScanDesc scan; @@ -843,6 +844,7 @@ RenameTableSpace(const char *oldname, const char *newname) errmsg("tablespace \"%s\" does not exist", oldname))); + tspId = HeapTupleGetOid(tup); newtuple = heap_copytuple(tup); newform = (Form_pg_tablespace) GETSTRUCT(newtuple); @@ -881,6 +883,8 @@ RenameTableSpace(const char *oldname, const char *newname) CatalogUpdateIndexes(rel, newtuple); heap_close(rel, NoLock); + + return tspId; } /* diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 91ef779c65..1f5932a477 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -1193,9 +1193,10 @@ RangeVarCallbackForRenameTrigger(const RangeVar *rv, Oid relid, Oid oldrelid, * modify tgname in trigger tuple * update row in catalog */ -void +Oid renametrig(RenameStmt *stmt) { + Oid tgoid; Relation targetrel; Relation tgrel; HeapTuple tuple; @@ -1261,6 +1262,7 @@ renametrig(RenameStmt *stmt) SnapshotNow, 2, key); if (HeapTupleIsValid(tuple = systable_getnext(tgscan))) { + tgoid = HeapTupleGetOid(tuple); /* * Update pg_trigger tuple with new tgname. */ @@ -1297,6 +1299,8 @@ renametrig(RenameStmt *stmt) * Close rel, but keep exclusive lock! */ relation_close(targetrel, NoLock); + + return tgoid; } diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c index e545e95a49..b922c6ed47 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -167,7 +167,7 @@ makeParserDependencies(HeapTuple tuple) /* * CREATE TEXT SEARCH PARSER */ -void +Oid DefineTSParser(List *names, List *parameters) { char *prsname; @@ -278,6 +278,8 @@ DefineTSParser(List *names, List *parameters) heap_freetuple(tup); heap_close(prsRel, RowExclusiveLock); + + return prsOid; } /* @@ -306,7 +308,7 @@ RemoveTSParserById(Oid prsId) /* * ALTER TEXT SEARCH PARSER RENAME */ -void +Oid RenameTSParser(List *oldname, const char *newname) { HeapTuple tup; @@ -344,6 +346,8 @@ RenameTSParser(List *oldname, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return prsId; } /* ---------------------- TS Dictionary commands -----------------------*/ @@ -439,7 +443,7 @@ verify_dictoptions(Oid tmplId, List *dictoptions) /* * CREATE TEXT SEARCH DICTIONARY */ -void +Oid DefineTSDictionary(List *names, List *parameters) { ListCell *pl; @@ -526,12 +530,14 @@ DefineTSDictionary(List *names, List *parameters) heap_freetuple(tup); heap_close(dictRel, RowExclusiveLock); + + return dictOid; } /* * ALTER TEXT SEARCH DICTIONARY RENAME */ -void +Oid RenameTSDictionary(List *oldname, const char *newname) { HeapTuple tup; @@ -577,6 +583,8 @@ RenameTSDictionary(List *oldname, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return dictId; } /* @@ -803,7 +811,7 @@ makeTSTemplateDependencies(HeapTuple tuple) /* * CREATE TEXT SEARCH TEMPLATE */ -void +Oid DefineTSTemplate(List *names, List *parameters) { ListCell *pl; @@ -813,7 +821,7 @@ DefineTSTemplate(List *names, List *parameters) bool nulls[Natts_pg_ts_template]; NameData dname; int i; - Oid dictOid; + Oid tmplOid; Oid namespaceoid; char *tmplname; @@ -877,7 +885,7 @@ DefineTSTemplate(List *names, List *parameters) tup = heap_form_tuple(tmplRel->rd_att, values, nulls); - dictOid = simple_heap_insert(tmplRel, tup); + tmplOid = simple_heap_insert(tmplRel, tup); CatalogUpdateIndexes(tmplRel, tup); @@ -885,17 +893,19 @@ DefineTSTemplate(List *names, List *parameters) /* Post creation hook for new text search template */ InvokeObjectAccessHook(OAT_POST_CREATE, - TSTemplateRelationId, dictOid, 0, NULL); + TSTemplateRelationId, tmplOid, 0, NULL); heap_freetuple(tup); heap_close(tmplRel, RowExclusiveLock); + + return tmplOid; } /* * ALTER TEXT SEARCH TEMPLATE RENAME */ -void +Oid RenameTSTemplate(List *oldname, const char *newname) { HeapTuple tup; @@ -934,6 +944,8 @@ RenameTSTemplate(List *oldname, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return tmplId; } /* @@ -1076,7 +1088,7 @@ makeConfigurationDependencies(HeapTuple tuple, bool removeOld, /* * CREATE TEXT SEARCH CONFIGURATION */ -void +Oid DefineTSConfiguration(List *names, List *parameters) { Relation cfgRel; @@ -1230,12 +1242,14 @@ DefineTSConfiguration(List *names, List *parameters) if (mapRel) heap_close(mapRel, RowExclusiveLock); heap_close(cfgRel, RowExclusiveLock); + + return cfgOid; } /* * ALTER TEXT SEARCH CONFIGURATION RENAME */ -void +Oid RenameTSConfiguration(List *oldname, const char *newname) { HeapTuple tup; @@ -1280,6 +1294,8 @@ RenameTSConfiguration(List *oldname, const char *newname) heap_close(rel, NoLock); heap_freetuple(tup); + + return cfgId; } /* diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 36de6d7e28..6f99f38f11 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -111,7 +111,7 @@ static char *domainAddConstraint(Oid domainOid, Oid domainNamespace, * DefineType * Registers a new base type. */ -void +Oid DefineType(List *names, List *parameters) { char *typeName; @@ -225,7 +225,7 @@ DefineType(List *names, List *parameters) * creating the shell type was all we're supposed to do. */ if (parameters == NIL) - return; + return InvalidOid; } else { @@ -593,39 +593,41 @@ DefineType(List *names, List *parameters) /* alignment must be 'i' or 'd' for arrays */ alignment = (alignment == 'd') ? 'd' : 'i'; - TypeCreate(array_oid, /* force assignment of this type OID */ - array_type, /* type name */ - typeNamespace, /* namespace */ - InvalidOid, /* relation oid (n/a here) */ - 0, /* relation kind (ditto) */ - GetUserId(), /* owner's ID */ - -1, /* internal size (always varlena) */ - TYPTYPE_BASE, /* type-type (base type) */ - TYPCATEGORY_ARRAY, /* type-category (array) */ - false, /* array types are never preferred */ - delimiter, /* array element delimiter */ - F_ARRAY_IN, /* input procedure */ - F_ARRAY_OUT, /* output procedure */ - F_ARRAY_RECV, /* receive procedure */ - F_ARRAY_SEND, /* send procedure */ - typmodinOid, /* typmodin procedure */ - typmodoutOid, /* typmodout procedure */ - F_ARRAY_TYPANALYZE, /* analyze procedure */ - typoid, /* element type ID */ - true, /* yes this is an array type */ - InvalidOid, /* no further array type */ - InvalidOid, /* base type ID */ - NULL, /* never a default type value */ - NULL, /* binary default isn't sent either */ - false, /* never passed by value */ - alignment, /* see above */ - 'x', /* ARRAY is always toastable */ - -1, /* typMod (Domains only) */ - 0, /* Array dimensions of typbasetype */ - false, /* Type NOT NULL */ - collation); /* type's collation */ + typoid = TypeCreate(array_oid, /* force assignment of this type OID */ + array_type, /* type name */ + typeNamespace, /* namespace */ + InvalidOid, /* relation oid (n/a here) */ + 0, /* relation kind (ditto) */ + GetUserId(), /* owner's ID */ + -1, /* internal size (always varlena) */ + TYPTYPE_BASE, /* type-type (base type) */ + TYPCATEGORY_ARRAY, /* type-category (array) */ + false, /* array types are never preferred */ + delimiter, /* array element delimiter */ + F_ARRAY_IN, /* input procedure */ + F_ARRAY_OUT, /* output procedure */ + F_ARRAY_RECV, /* receive procedure */ + F_ARRAY_SEND, /* send procedure */ + typmodinOid, /* typmodin procedure */ + typmodoutOid, /* typmodout procedure */ + F_ARRAY_TYPANALYZE, /* analyze procedure */ + typoid, /* element type ID */ + true, /* yes this is an array type */ + InvalidOid, /* no further array type */ + InvalidOid, /* base type ID */ + NULL, /* never a default type value */ + NULL, /* binary default isn't sent either */ + false, /* never passed by value */ + alignment, /* see above */ + 'x', /* ARRAY is always toastable */ + -1, /* typMod (Domains only) */ + 0, /* Array dimensions of typbasetype */ + false, /* Type NOT NULL */ + collation); /* type's collation */ pfree(array_type); + + return typoid; } /* @@ -671,7 +673,7 @@ RemoveTypeById(Oid typeOid) * DefineDomain * Registers a new domain. */ -void +Oid DefineDomain(CreateDomainStmt *stmt) { char *domainName; @@ -1042,6 +1044,8 @@ DefineDomain(CreateDomainStmt *stmt) * Now we can clean up. */ ReleaseSysCache(typeTup); + + return domainoid; } @@ -3092,7 +3096,7 @@ GetDomainConstraints(Oid typeOid) /* * Execute ALTER TYPE RENAME */ -void +Oid RenameType(RenameStmt *stmt) { List *names = stmt->object; @@ -3161,12 +3165,14 @@ RenameType(RenameStmt *stmt) /* Clean up */ heap_close(rel, RowExclusiveLock); + + return typeOid; } /* * Change the owner of a type. */ -void +Oid AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype) { TypeName *typename; @@ -3283,6 +3289,8 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype) /* Clean up */ heap_close(rel, RowExclusiveLock); + + return typeOid; } /* @@ -3335,7 +3343,7 @@ AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId, /* * Execute ALTER TYPE SET SCHEMA */ -void +Oid AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype) { TypeName *typename; @@ -3360,6 +3368,8 @@ AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype) objsMoved = new_object_addresses(); AlterTypeNamespace_oid(typeOid, nspOid, objsMoved); free_object_addresses(objsMoved); + + return typeOid; } Oid diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index f178167d62..569385cf23 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -1036,7 +1036,7 @@ DropRole(DropRoleStmt *stmt) /* * Rename role */ -void +Oid RenameRole(const char *oldname, const char *newname) { HeapTuple oldtuple, @@ -1142,6 +1142,8 @@ RenameRole(const char *oldname, const char *newname) * Close pg_authid, but keep lock till commit. */ heap_close(rel, NoLock); + + return roleid; } /* diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index 3e7e39d8ec..1d49667981 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -420,7 +420,7 @@ UpdateRangeTableOfViewParse(Oid viewOid, Query *viewParse) * DefineView * Execute a CREATE VIEW command. */ -void +Oid DefineView(ViewStmt *stmt, const char *queryString) { Query *viewParse; @@ -540,4 +540,6 @@ DefineView(ViewStmt *stmt, const char *queryString) * Now create the rules associated with the view. */ DefineViewRules(viewOid, viewParse, stmt->replace); + + return viewOid; } diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index abfec5cdb9..637c0b6c27 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -1728,7 +1728,7 @@ DESCR("range intersection"); /* * function prototypes */ -extern void OperatorCreate(const char *operatorName, +extern Oid OperatorCreate(const char *operatorName, Oid operatorNamespace, Oid leftTypeId, Oid rightTypeId, diff --git a/src/include/commands/alter.h b/src/include/commands/alter.h index 4493985ad3..036ebe0780 100644 --- a/src/include/commands/alter.h +++ b/src/include/commands/alter.h @@ -18,14 +18,14 @@ #include "nodes/parsenodes.h" #include "utils/relcache.h" -extern void ExecRenameStmt(RenameStmt *stmt); +extern Oid ExecRenameStmt(RenameStmt *stmt); -extern void ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt); +extern Oid ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt); extern Oid AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid, ObjectAddresses *objsMoved); extern Oid AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid); -extern void ExecAlterOwnerStmt(AlterOwnerStmt *stmt); +extern Oid ExecAlterOwnerStmt(AlterOwnerStmt *stmt); extern void AlterObjectOwner_internal(Relation catalog, Oid objectId, Oid new_ownerId); diff --git a/src/include/commands/collationcmds.h b/src/include/commands/collationcmds.h index 6d9db099c2..f3c6f62f17 100644 --- a/src/include/commands/collationcmds.h +++ b/src/include/commands/collationcmds.h @@ -17,9 +17,9 @@ #include "nodes/parsenodes.h" -extern void DefineCollation(List *names, List *parameters); -extern void RenameCollation(List *name, const char *newname); -extern void AlterCollationNamespace(List *name, const char *newschema); +extern Oid DefineCollation(List *names, List *parameters); +extern Oid RenameCollation(List *name, const char *newname); +extern Oid AlterCollationNamespace(List *name, const char *newschema); extern Oid AlterCollationNamespace_oid(Oid collOid, Oid newNspOid); #endif /* COLLATIONCMDS_H */ diff --git a/src/include/commands/conversioncmds.h b/src/include/commands/conversioncmds.h index 2f9abad947..844fb41e10 100644 --- a/src/include/commands/conversioncmds.h +++ b/src/include/commands/conversioncmds.h @@ -17,7 +17,7 @@ #include "nodes/parsenodes.h" -extern void CreateConversionCommand(CreateConversionStmt *parsetree); -extern void RenameConversion(List *name, const char *newname); +extern Oid CreateConversionCommand(CreateConversionStmt *parsetree); +extern Oid RenameConversion(List *name, const char *newname); #endif /* CONVERSIONCMDS_H */ diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h index 41ca8ff199..a48cf5f7b9 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -54,10 +54,10 @@ typedef struct xl_dbase_drop_rec extern void createdb(const CreatedbStmt *stmt); extern void dropdb(const char *dbname, bool missing_ok); -extern void RenameDatabase(const char *oldname, const char *newname); +extern Oid RenameDatabase(const char *oldname, const char *newname); extern void AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel); extern void AlterDatabaseSet(AlterDatabaseSetStmt *stmt); -extern void AlterDatabaseOwner(const char *dbname, Oid newOwnerId); +extern Oid AlterDatabaseOwner(const char *dbname, Oid newOwnerId); extern Oid get_database_oid(const char *dbname, bool missingok); extern char *get_database_name(Oid dbid); diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 2c81b78997..263f48cc97 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -42,28 +42,28 @@ extern bool CheckIndexCompatible(Oid oldId, extern Oid GetDefaultOpClass(Oid type_id, Oid am_id); /* commands/functioncmds.c */ -extern void CreateFunction(CreateFunctionStmt *stmt, const char *queryString); +extern Oid CreateFunction(CreateFunctionStmt *stmt, const char *queryString); extern void RemoveFunctionById(Oid funcOid); extern void SetFunctionReturnType(Oid funcOid, Oid newRetType); extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType); -extern void RenameFunction(List *name, List *argtypes, const char *newname); +extern Oid RenameFunction(List *name, List *argtypes, const char *newname); extern void AlterFunction(AlterFunctionStmt *stmt); extern void CreateCast(CreateCastStmt *stmt); extern void DropCastById(Oid castOid); -extern void AlterFunctionNamespace(List *name, List *argtypes, bool isagg, - const char *newschema); +extern Oid AlterFunctionNamespace(List *name, List *argtypes, bool isagg, + const char *newschema); extern Oid AlterFunctionNamespace_oid(Oid procOid, Oid nspOid); extern void ExecuteDoStmt(DoStmt *stmt); extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok); /* commands/operatorcmds.c */ -extern void DefineOperator(List *names, List *parameters); +extern Oid DefineOperator(List *names, List *parameters); extern void RemoveOperatorById(Oid operOid); /* commands/aggregatecmds.c */ -extern void DefineAggregate(List *name, List *args, bool oldstyle, +extern Oid DefineAggregate(List *name, List *args, bool oldstyle, List *parameters); -extern void RenameAggregate(List *name, List *args, const char *newname); +extern Oid RenameAggregate(List *name, List *args, const char *newname); /* commands/opclasscmds.c */ extern void DefineOpClass(CreateOpClassStmt *stmt); @@ -73,28 +73,28 @@ extern void RemoveOpClassById(Oid opclassOid); extern void RemoveOpFamilyById(Oid opfamilyOid); extern void RemoveAmOpEntryById(Oid entryOid); extern void RemoveAmProcEntryById(Oid entryOid); -extern void RenameOpClass(List *name, const char *access_method, const char *newname); -extern void RenameOpFamily(List *name, const char *access_method, const char *newname); +extern Oid RenameOpClass(List *name, const char *access_method, const char *newname); +extern Oid RenameOpFamily(List *name, const char *access_method, const char *newname); extern Oid get_am_oid(const char *amname, bool missing_ok); extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok); extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok); /* commands/tsearchcmds.c */ -extern void DefineTSParser(List *names, List *parameters); -extern void RenameTSParser(List *oldname, const char *newname); +extern Oid DefineTSParser(List *names, List *parameters); +extern Oid RenameTSParser(List *oldname, const char *newname); extern void RemoveTSParserById(Oid prsId); -extern void DefineTSDictionary(List *names, List *parameters); -extern void RenameTSDictionary(List *oldname, const char *newname); +extern Oid DefineTSDictionary(List *names, List *parameters); +extern Oid RenameTSDictionary(List *oldname, const char *newname); extern void RemoveTSDictionaryById(Oid dictId); extern void AlterTSDictionary(AlterTSDictionaryStmt *stmt); -extern void DefineTSTemplate(List *names, List *parameters); -extern void RenameTSTemplate(List *oldname, const char *newname); +extern Oid DefineTSTemplate(List *names, List *parameters); +extern Oid RenameTSTemplate(List *oldname, const char *newname); extern void RemoveTSTemplateById(Oid tmplId); -extern void DefineTSConfiguration(List *names, List *parameters); -extern void RenameTSConfiguration(List *oldname, const char *newname); +extern Oid DefineTSConfiguration(List *names, List *parameters); +extern Oid RenameTSConfiguration(List *oldname, const char *newname); extern void RemoveTSConfigurationById(Oid cfgId); extern void AlterTSConfiguration(AlterTSConfigurationStmt *stmt); @@ -102,11 +102,11 @@ extern text *serialize_deflist(List *deflist); extern List *deserialize_deflist(Datum txt); /* commands/foreigncmds.c */ -extern void RenameForeignServer(const char *oldname, const char *newname); -extern void RenameForeignDataWrapper(const char *oldname, const char *newname); -extern void AlterForeignServerOwner(const char *name, Oid newOwnerId); +extern Oid RenameForeignServer(const char *oldname, const char *newname); +extern Oid RenameForeignDataWrapper(const char *oldname, const char *newname); +extern Oid AlterForeignServerOwner(const char *name, Oid newOwnerId); extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId); -extern void AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); +extern Oid AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId); extern void CreateForeignDataWrapper(CreateFdwStmt *stmt); extern void AlterForeignDataWrapper(AlterFdwStmt *stmt); diff --git a/src/include/commands/extension.h b/src/include/commands/extension.h index f0847ff3fb..205807512e 100644 --- a/src/include/commands/extension.h +++ b/src/include/commands/extension.h @@ -27,7 +27,7 @@ extern bool creating_extension; extern Oid CurrentExtensionObject; -extern void CreateExtension(CreateExtensionStmt *stmt); +extern Oid CreateExtension(CreateExtensionStmt *stmt); extern void RemoveExtensionById(Oid extId); @@ -43,7 +43,7 @@ extern void ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt); extern Oid get_extension_oid(const char *extname, bool missing_ok); extern char *get_extension_name(Oid ext_oid); -extern void AlterExtensionNamespace(List *names, const char *newschema); +extern Oid AlterExtensionNamespace(List *names, const char *newschema); extern void AlterExtensionOwner_oid(Oid extensionOid, Oid newOwnerId); diff --git a/src/include/commands/proclang.h b/src/include/commands/proclang.h index faf1f1c9f8..bc380792e5 100644 --- a/src/include/commands/proclang.h +++ b/src/include/commands/proclang.h @@ -16,7 +16,7 @@ extern void CreateProceduralLanguage(CreatePLangStmt *stmt); extern void DropProceduralLanguageById(Oid langOid); -extern void RenameLanguage(const char *oldname, const char *newname); +extern Oid RenameLanguage(const char *oldname, const char *newname); extern bool PLTemplateExists(const char *languageName); extern Oid get_language_oid(const char *langname, bool missing_ok); diff --git a/src/include/commands/schemacmds.h b/src/include/commands/schemacmds.h index ea709c3d92..1529eb1b85 100644 --- a/src/include/commands/schemacmds.h +++ b/src/include/commands/schemacmds.h @@ -17,13 +17,13 @@ #include "nodes/parsenodes.h" -extern void CreateSchemaCommand(CreateSchemaStmt *parsetree, +extern Oid CreateSchemaCommand(CreateSchemaStmt *parsetree, const char *queryString); extern void RemoveSchemaById(Oid schemaOid); -extern void RenameSchema(const char *oldname, const char *newname); -extern void AlterSchemaOwner(const char *name, Oid newOwnerId); +extern Oid RenameSchema(const char *oldname, const char *newname); +extern Oid AlterSchemaOwner(const char *name, Oid newOwnerId); extern void AlterSchemaOwner_oid(Oid schemaOid, Oid newOwnerId); #endif /* SCHEMACMDS_H */ diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h index 2cdf86f101..56bfaadf7f 100644 --- a/src/include/commands/sequence.h +++ b/src/include/commands/sequence.h @@ -71,8 +71,8 @@ extern Datum lastval(PG_FUNCTION_ARGS); extern Datum pg_sequence_parameters(PG_FUNCTION_ARGS); -extern void DefineSequence(CreateSeqStmt *stmt); -extern void AlterSequence(AlterSeqStmt *stmt); +extern Oid DefineSequence(CreateSeqStmt *stmt); +extern Oid AlterSequence(AlterSeqStmt *stmt); extern void ResetSequence(Oid seq_relid); extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr); diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index 4f32062056..d0ef4ae170 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -51,11 +51,11 @@ extern void ExecuteTruncate(TruncateStmt *stmt); extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass); -extern void renameatt(RenameStmt *stmt); +extern Oid renameatt(RenameStmt *stmt); -extern void RenameConstraint(RenameStmt *stmt); +extern Oid RenameConstraint(RenameStmt *stmt); -extern void RenameRelation(RenameStmt *stmt); +extern Oid RenameRelation(RenameStmt *stmt); extern void RenameRelationInternal(Oid myrelid, const char *newrelname); diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h index be45c875c9..4d5cb89101 100644 --- a/src/include/commands/tablespace.h +++ b/src/include/commands/tablespace.h @@ -41,7 +41,7 @@ typedef struct TableSpaceOpts extern void CreateTableSpace(CreateTableSpaceStmt *stmt); extern void DropTableSpace(DropTableSpaceStmt *stmt); -extern void RenameTableSpace(const char *oldname, const char *newname); +extern Oid RenameTableSpace(const char *oldname, const char *newname); extern void AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt); extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo); diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index e790b9d300..a678750589 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -115,7 +115,7 @@ extern Oid CreateTrigger(CreateTrigStmt *stmt, const char *queryString, extern void RemoveTriggerById(Oid trigOid); extern Oid get_trigger_oid(Oid relid, const char *name, bool missing_ok); -extern void renametrig(RenameStmt *stmt); +extern Oid renametrig(RenameStmt *stmt); extern void EnableDisableTrigger(Relation rel, const char *tgname, char fires_when, bool skip_system); diff --git a/src/include/commands/typecmds.h b/src/include/commands/typecmds.h index e87ca90089..48ee0163bd 100644 --- a/src/include/commands/typecmds.h +++ b/src/include/commands/typecmds.h @@ -21,9 +21,9 @@ #define DEFAULT_TYPDELIM ',' -extern void DefineType(List *names, List *parameters); +extern Oid DefineType(List *names, List *parameters); extern void RemoveTypeById(Oid typeOid); -extern void DefineDomain(CreateDomainStmt *stmt); +extern Oid DefineDomain(CreateDomainStmt *stmt); extern void DefineEnum(CreateEnumStmt *stmt); extern void DefineRange(CreateRangeStmt *stmt); extern void AlterEnum(AlterEnumStmt *stmt, bool isTopLevel); @@ -41,11 +41,11 @@ extern void checkDomainOwner(HeapTuple tup); extern List *GetDomainConstraints(Oid typeOid); -extern void RenameType(RenameStmt *stmt); -extern void AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); +extern Oid RenameType(RenameStmt *stmt); +extern Oid AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); extern void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId, bool hasDependEntry); -extern void AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype); +extern Oid AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype); extern Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved); extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, bool isImplicitArray, diff --git a/src/include/commands/user.h b/src/include/commands/user.h index 476654abf6..650fcea557 100644 --- a/src/include/commands/user.h +++ b/src/include/commands/user.h @@ -27,7 +27,7 @@ extern void AlterRole(AlterRoleStmt *stmt); extern void AlterRoleSet(AlterRoleSetStmt *stmt); extern void DropRole(DropRoleStmt *stmt); extern void GrantRole(GrantRoleStmt *stmt); -extern void RenameRole(const char *oldname, const char *newname); +extern Oid RenameRole(const char *oldname, const char *newname); extern void DropOwnedObjects(DropOwnedStmt *stmt); extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt); diff --git a/src/include/commands/view.h b/src/include/commands/view.h index efebf95b7a..f0b6b82223 100644 --- a/src/include/commands/view.h +++ b/src/include/commands/view.h @@ -16,6 +16,6 @@ #include "nodes/parsenodes.h" -extern void DefineView(ViewStmt *stmt, const char *queryString); +extern Oid DefineView(ViewStmt *stmt, const char *queryString); #endif /* VIEW_H */