0003-Remove-RelationGetIndexRawAttOptions.patch
text/plain
Filename: 0003-Remove-RelationGetIndexRawAttOptions.patch
Type: text/plain
Part: 2
Patch
Format: format-patch
Series: patch 0003
Subject: Remove RelationGetIndexRawAttOptions()
| File | + | − |
|---|---|---|
| src/backend/commands/indexcmds.c | 5 | 3 |
| src/backend/utils/cache/relcache.c | 0 | 29 |
| src/include/utils/relcache.h | 0 | 1 |
From d123e508f8821e053ad57c5405045e138bc3d405 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Thu, 24 Aug 2023 08:26:13 +0200
Subject: [PATCH 3/3] 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.
---
src/backend/commands/indexcmds.c | 8 +++++---
src/backend/utils/cache/relcache.c | 29 -----------------------------
src/include/utils/relcache.h | 1 -
3 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index a53861cecf..c160d8a301 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -301,12 +301,14 @@ CheckIndexCompatible(Oid oldId,
/* Any change in opclass options break compatibility. */
if (ret)
{
- Datum *oldOpclassOptions = RelationGetIndexRawAttOptions(irel);
+ Datum *oldOpclassOptions = palloc_array(Datum, old_natts);
+
+ for (i = 0; i < old_natts; i++)
+ oldOpclassOptions[i] = get_attoptions(oldId, i + 1);
ret = CompareOpclassOptions(oldOpclassOptions, opclassOptions, old_natts);
- if (oldOpclassOptions)
- pfree(oldOpclassOptions);
+ pfree(oldOpclassOptions);
}
/* Any change in exclusion operator selections breaks compatibility. */
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 8e08ca1c68..dd09a5f896 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -5799,35 +5799,6 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
MemoryContextSwitchTo(oldcxt);
}
-/*
- * RelationGetIndexRawAttOptions -- get AM/opclass-specific options for the index
- */
-Datum *
-RelationGetIndexRawAttOptions(Relation indexrel)
-{
- Oid indexrelid = RelationGetRelid(indexrel);
- int16 natts = RelationGetNumberOfAttributes(indexrel);
- Datum *options = NULL;
- int16 attnum;
-
- for (attnum = 1; attnum <= natts; attnum++)
- {
- if (indexrel->rd_indam->amoptsprocnum == 0)
- continue;
-
- if (!OidIsValid(index_getprocid(indexrel, attnum,
- indexrel->rd_indam->amoptsprocnum)))
- continue;
-
- if (!options)
- options = palloc0(sizeof(Datum) * natts);
-
- options[attnum - 1] = get_attoptions(indexrelid, attnum);
- }
-
- return options;
-}
-
static bytea **
CopyIndexAttOptions(bytea **srcopts, int natts)
{
diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h
index 38524641f4..b0955c0e62 100644
--- a/src/include/utils/relcache.h
+++ b/src/include/utils/relcache.h
@@ -51,7 +51,6 @@ extern Oid RelationGetReplicaIndex(Relation relation);
extern List *RelationGetIndexExpressions(Relation relation);
extern List *RelationGetDummyIndexExpressions(Relation relation);
extern List *RelationGetIndexPredicate(Relation relation);
-extern Datum *RelationGetIndexRawAttOptions(Relation indexrel);
extern bytea **RelationGetIndexAttOptions(Relation relation, bool copy);
/*
--
2.41.0