Skip to content

Commit 5e42827

Browse files
committed
Remove RelationGetIndexRawAttOptions()
There was only one caller left, for which this function was overkill. Also, having it in relcache.c was inappropriate, since it doesn't work with the relcache at all. Discussion: https://www.postgresql.org/message-id/flat/f84640e3-00d3-5abd-3f41-e6a19d33c40b@eisentraut.org
1 parent 7841623 commit 5e42827

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

src/backend/commands/indexcmds.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,14 @@ CheckIndexCompatible(Oid oldId,
301301
/* Any change in opclass options break compatibility. */
302302
if (ret)
303303
{
304-
Datum *oldOpclassOptions = RelationGetIndexRawAttOptions(irel);
304+
Datum *oldOpclassOptions = palloc_array(Datum, old_natts);
305+
306+
for (i = 0; i < old_natts; i++)
307+
oldOpclassOptions[i] = get_attoptions(oldId, i + 1);
305308

306309
ret = CompareOpclassOptions(oldOpclassOptions, opclassOptions, old_natts);
307310

308-
if (oldOpclassOptions)
309-
pfree(oldOpclassOptions);
311+
pfree(oldOpclassOptions);
310312
}
311313

312314
/* Any change in exclusion operator selections breaks compatibility. */

src/backend/utils/cache/relcache.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5821,35 +5821,6 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
58215821
MemoryContextSwitchTo(oldcxt);
58225822
}
58235823

5824-
/*
5825-
* RelationGetIndexRawAttOptions -- get AM/opclass-specific options for the index
5826-
*/
5827-
Datum *
5828-
RelationGetIndexRawAttOptions(Relation indexrel)
5829-
{
5830-
Oid indexrelid = RelationGetRelid(indexrel);
5831-
int16 natts = RelationGetNumberOfAttributes(indexrel);
5832-
Datum *options = NULL;
5833-
int16 attnum;
5834-
5835-
for (attnum = 1; attnum <= natts; attnum++)
5836-
{
5837-
if (indexrel->rd_indam->amoptsprocnum == 0)
5838-
continue;
5839-
5840-
if (!OidIsValid(index_getprocid(indexrel, attnum,
5841-
indexrel->rd_indam->amoptsprocnum)))
5842-
continue;
5843-
5844-
if (!options)
5845-
options = palloc0(sizeof(Datum) * natts);
5846-
5847-
options[attnum - 1] = get_attoptions(indexrelid, attnum);
5848-
}
5849-
5850-
return options;
5851-
}
5852-
58535824
static bytea **
58545825
CopyIndexAttOptions(bytea **srcopts, int natts)
58555826
{

src/include/utils/relcache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ extern Oid RelationGetReplicaIndex(Relation relation);
5151
extern List *RelationGetIndexExpressions(Relation relation);
5252
extern List *RelationGetDummyIndexExpressions(Relation relation);
5353
extern List *RelationGetIndexPredicate(Relation relation);
54-
extern Datum *RelationGetIndexRawAttOptions(Relation indexrel);
5554
extern bytea **RelationGetIndexAttOptions(Relation relation, bool copy);
5655

5756
/*

0 commit comments

Comments
 (0)