diff options
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r-- | src/backend/commands/dbcommands.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 6ad8fd77b10..c3eb3c79df4 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -546,10 +546,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) HeapTupleSetOid(tuple, dboid); - simple_heap_insert(pg_database_rel, tuple); - - /* Update indexes */ - CatalogUpdateIndexes(pg_database_rel, tuple); + CatalogTupleInsert(pg_database_rel, tuple); /* * Now generate additional catalog entries associated with the new DB @@ -1040,8 +1037,7 @@ RenameDatabase(const char *oldname, const char *newname) if (!HeapTupleIsValid(newtup)) elog(ERROR, "cache lookup failed for database %u", db_id); namestrcpy(&(((Form_pg_database) GETSTRUCT(newtup))->datname), newname); - simple_heap_update(rel, &newtup->t_self, newtup); - CatalogUpdateIndexes(rel, newtup); + CatalogTupleUpdate(rel, &newtup->t_self, newtup); InvokeObjectPostAlterHook(DatabaseRelationId, db_id, 0); @@ -1296,10 +1292,7 @@ movedb(const char *dbname, const char *tblspcname) newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(pgdbrel), new_record, new_record_nulls, new_record_repl); - simple_heap_update(pgdbrel, &oldtuple->t_self, newtuple); - - /* Update indexes */ - CatalogUpdateIndexes(pgdbrel, newtuple); + CatalogTupleUpdate(pgdbrel, &oldtuple->t_self, newtuple); InvokeObjectPostAlterHook(DatabaseRelationId, HeapTupleGetOid(newtuple), 0); @@ -1554,10 +1547,7 @@ AlterDatabase(ParseState *pstate, AlterDatabaseStmt *stmt, bool isTopLevel) newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), new_record, new_record_nulls, new_record_repl); - simple_heap_update(rel, &tuple->t_self, newtuple); - - /* Update indexes */ - CatalogUpdateIndexes(rel, newtuple); + CatalogTupleUpdate(rel, &tuple->t_self, newtuple); InvokeObjectPostAlterHook(DatabaseRelationId, HeapTupleGetOid(newtuple), 0); @@ -1692,8 +1682,7 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId) } newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), repl_val, repl_null, repl_repl); - simple_heap_update(rel, &newtuple->t_self, newtuple); - CatalogUpdateIndexes(rel, newtuple); + CatalogTupleUpdate(rel, &newtuple->t_self, newtuple); heap_freetuple(newtuple); |