mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user