mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Fix use-after-free introduced in 55ed3defc966
Evidenced by failure under RELCACHE_FORCE_RELEASE (buildfarm member prion). Author: Amit Langote Discussion: https://postgr.es/m/CA+HiwqGV=k_Eh4jBiQw66ivvdG+EUkrEYeHTYL1SvDj_YOYV0g@mail.gmail.com
This commit is contained in:
parent
9653ca2197
commit
e4f2d4fe92
@ -896,13 +896,11 @@ DefineIndex(Oid relationId,
|
||||
|
||||
memcpy(part_oids, partdesc->oids, sizeof(Oid) * nparts);
|
||||
|
||||
parentDesc = CreateTupleDescCopy(RelationGetDescr(rel));
|
||||
parentDesc = RelationGetDescr(rel);
|
||||
opfamOids = palloc(sizeof(Oid) * numberOfKeyAttributes);
|
||||
for (i = 0; i < numberOfKeyAttributes; i++)
|
||||
opfamOids[i] = get_opclass_family(classObjectId[i]);
|
||||
|
||||
heap_close(rel, NoLock);
|
||||
|
||||
/*
|
||||
* For each partition, scan all existing indexes; if one matches
|
||||
* our index definition and is not already attached to some other
|
||||
@ -1100,13 +1098,12 @@ DefineIndex(Oid relationId,
|
||||
heap_freetuple(newtup);
|
||||
}
|
||||
}
|
||||
else
|
||||
heap_close(rel, NoLock);
|
||||
|
||||
/*
|
||||
* Indexes on partitioned tables are not themselves built, so we're
|
||||
* done here.
|
||||
*/
|
||||
heap_close(rel, NoLock);
|
||||
return address;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user