mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Simplify signature of RewriteTable
This function doesn't need the lockmode to be passed: it was being used to lock the new heap, but that's bogus, because the only caller has already obtained the appropriate lock on the new heap (which is unimportant anyway, because the relation's creation is not yet committed and so no other session can see it). Noticed while reviewed Antonin Houska's patch to add VACUUM FULL CONCURRENTLY.
This commit is contained in:
parent
6313a76b35
commit
ebd8fc7e47
@ -433,7 +433,7 @@ static AlterTableCmd *ATParseTransformCmd(List **wqueue, AlteredTableInfo *tab,
|
||||
static void ATRewriteTables(AlterTableStmt *parsetree,
|
||||
List **wqueue, LOCKMODE lockmode,
|
||||
AlterTableUtilityContext *context);
|
||||
static void ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode);
|
||||
static void ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap);
|
||||
static AlteredTableInfo *ATGetQueueEntry(List **wqueue, Relation rel);
|
||||
static void ATSimplePermissions(AlterTableType cmdtype, Relation rel, int allowed_targets);
|
||||
static void ATSimpleRecursion(List **wqueue, Relation rel,
|
||||
@ -5901,7 +5901,7 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode,
|
||||
* modifications, and test the current data within the table
|
||||
* against new constraints generated by ALTER TABLE commands.
|
||||
*/
|
||||
ATRewriteTable(tab, OIDNewHeap, lockmode);
|
||||
ATRewriteTable(tab, OIDNewHeap);
|
||||
|
||||
/*
|
||||
* Swap the physical files of the old and new heaps, then rebuild
|
||||
@ -5934,7 +5934,7 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode,
|
||||
*/
|
||||
if (tab->constraints != NIL || tab->verify_new_notnull ||
|
||||
tab->partition_constraint != NULL)
|
||||
ATRewriteTable(tab, InvalidOid, lockmode);
|
||||
ATRewriteTable(tab, InvalidOid);
|
||||
|
||||
/*
|
||||
* If we had SET TABLESPACE but no reason to reconstruct tuples,
|
||||
@ -6033,10 +6033,11 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode,
|
||||
/*
|
||||
* ATRewriteTable: scan or rewrite one table
|
||||
*
|
||||
* OIDNewHeap is InvalidOid if we don't need to rewrite
|
||||
* A rewrite is requested by passing a valid OIDNewHeap; in that case, caller
|
||||
* must already hold AccessExclusiveLock on it.
|
||||
*/
|
||||
static void
|
||||
ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
|
||||
ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap)
|
||||
{
|
||||
Relation oldrel;
|
||||
Relation newrel;
|
||||
@ -6061,7 +6062,11 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
|
||||
newTupDesc = RelationGetDescr(oldrel); /* includes all mods */
|
||||
|
||||
if (OidIsValid(OIDNewHeap))
|
||||
newrel = table_open(OIDNewHeap, lockmode);
|
||||
{
|
||||
Assert(CheckRelationOidLockedByMe(OIDNewHeap, AccessExclusiveLock,
|
||||
false));
|
||||
newrel = table_open(OIDNewHeap, NoLock);
|
||||
}
|
||||
else
|
||||
newrel = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user