Skip to content

Commit 050098b

Browse files
committed
Fix use-after-free introduced in 55ed3de
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
1 parent f2f0082 commit 050098b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/backend/commands/indexcmds.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,13 +1059,11 @@ DefineIndex(Oid relationId,
10591059

10601060
memcpy(part_oids, partdesc->oids, sizeof(Oid) * nparts);
10611061

1062-
parentDesc = CreateTupleDescCopy(RelationGetDescr(rel));
1062+
parentDesc = RelationGetDescr(rel);
10631063
opfamOids = palloc(sizeof(Oid) * numberOfKeyAttributes);
10641064
for (i = 0; i < numberOfKeyAttributes; i++)
10651065
opfamOids[i] = get_opclass_family(classObjectId[i]);
10661066

1067-
table_close(rel, NoLock);
1068-
10691067
/*
10701068
* For each partition, scan all existing indexes; if one matches
10711069
* our index definition and is not already attached to some other
@@ -1265,13 +1263,12 @@ DefineIndex(Oid relationId,
12651263
heap_freetuple(newtup);
12661264
}
12671265
}
1268-
else
1269-
table_close(rel, NoLock);
12701266

12711267
/*
12721268
* Indexes on partitioned tables are not themselves built, so we're
12731269
* done here.
12741270
*/
1271+
table_close(rel, NoLock);
12751272
if (!OidIsValid(parentIndexId))
12761273
pgstat_progress_end_command();
12771274
return address;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy