diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-25 16:54:30 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-25 16:54:30 +0000 |
commit | 577759f8bf53cfaf7e24ee217933df2c882bedbf (patch) | |
tree | 250b17cf47750a4822ced515805b8c15eda41424 /src | |
parent | 19cc0c4faf66918d7a1675ec25c0308839e2b9ea (diff) |
Fix ancient memory leak in index_create(): RelationInitIndexAccessInfo
was being called twice in normal operation, leading to a leak of one set
of relcache subsidiary info. Per report from Jeff Gold.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/catalog/index.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 0c8f5327c96..debc3945eec 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.202 2002/10/21 22:06:19 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.202.2.1 2005/06/25 16:54:30 tgl Exp $ * * * INTERFACE ROUTINES @@ -736,13 +736,21 @@ index_create(Oid heapRelationId, } /* - * Fill in the index strategy structure with information from the - * catalogs. First we must advance the command counter so that we - * will see the newly-entered index catalog tuples. + * Advance the command counter so that we can see the newly-entered + * catalog tuples for the index. */ CommandCounterIncrement(); - RelationInitIndexAccessInfo(indexRelation); + /* + * In bootstrap mode, we have to fill in the index strategy structure + * with information from the catalogs. If we aren't bootstrapping, + * then the relcache entry has already been rebuilt thanks to sinval + * update during CommandCounterIncrement. + */ + if (IsBootstrapProcessingMode()) + RelationInitIndexAccessInfo(indexRelation); + else + Assert(indexRelation->rd_indexcxt != NULL); /* * If this is bootstrap (initdb) time, then we don't actually fill in |