1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +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:
Robert Haas
2012-12-23 18:25:03 -05:00
parent 31bc839724
commit c504513f83
39 changed files with 385 additions and 276 deletions

View File

@ -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;
}