On 04.02.25 14:31, Peter Eisentraut wrote:
On 03.02.25 12:08, Peter Eisentraut wrote:
Yeah, actually this turned out to be unnecessary, because you can
easily obtain the AM OID from the passed-in opclass ID. So I have
fixed it that way. I have committed this whole patch set now with the
mentioned adjustments. I'll post a rebased version of the main patch
set soon.
I picked off two more patches from the full patch series that can be
dealt with easily. These are
- Support non-btree indexes for foreign keys
- Allow non-btree speculative insertion indexes
(v19-0012 and v19-0013)
The version of these patches that were posted in the v19 bundle replaced
the hardcoded comparison with BTREE_AM_OID by a check against
(indirectly) amcanunique. But I think that is not necessary, because at
that point we already know that we are dealing with a unique index. The
reason for the check against BTREE_AM_OID was that we didn't have a way
to get the right strategy number for other index methods. But now we
have, so we can use the strategy translation functions and we don't need
to check for btree-ness anymore.
See attached patches.
I have committed these.
Here is another small issue. In the v19.2 patches, I had changed the
argument of the gist strategy translation function from opclass to
opfamily+opcintype. This worked well with the existing uses, but when
rebasing the rest of the main patch set, it seems that the correct value
of "opcintype" is not always clear or readily available. And if you
think about it, we don't need that type, because the strategy mapping
function is surely the same for all types supported by an opfamily. So
we could simplify that by registering the gist stratnum support function
in a way that you can look it up without having to worry about the type.
Apparently, you can't register it with just zero in
amproclefttype/amprocrighttype, that confuses some DDL commands. But I
figure we could put the pseudotype "any" in there, which is moderately
intuitive. And then we can drop the opcintype from all the APIs, which
simplifies things.
See attached patches. Thoughts?
From 50ce2bca712e35b5a546cf9e9d55661d711aadb9 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Fri, 7 Feb 2025 15:48:43 +0100
Subject: [PATCH v19.4 1/2] Change gist stategy support procedure to take
"any", "any" as argument
---
contrib/btree_gist/btree_gist--1.7--1.8.sql | 52 ++++++++++-----------
doc/src/sgml/gist.sgml | 6 +++
src/backend/access/gist/gistutil.c | 2 +-
src/backend/access/gist/gistvalidate.c | 4 +-
src/include/catalog/pg_amproc.dat | 24 +++++-----
5 files changed, 48 insertions(+), 40 deletions(-)
diff --git a/contrib/btree_gist/btree_gist--1.7--1.8.sql
b/contrib/btree_gist/btree_gist--1.7--1.8.sql
index c702426deab..4ff9c43a8eb 100644
--- a/contrib/btree_gist/btree_gist--1.7--1.8.sql
+++ b/contrib/btree_gist/btree_gist--1.7--1.8.sql
@@ -9,79 +9,79 @@ CREATE FUNCTION gist_stratnum_btree(int)
LANGUAGE C IMMUTABLE PARALLEL SAFE STRICT;
ALTER OPERATOR FAMILY gist_oid_ops USING gist ADD
- FUNCTION 12 (oid, oid) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_int2_ops USING gist ADD
- FUNCTION 12 (int2, int2) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_int4_ops USING gist ADD
- FUNCTION 12 (int4, int4) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_int8_ops USING gist ADD
- FUNCTION 12 (int8, int8) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_float4_ops USING gist ADD
- FUNCTION 12 (float4, float4) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_float8_ops USING gist ADD
- FUNCTION 12 (float8, float8) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_timestamp_ops USING gist ADD
- FUNCTION 12 (timestamp, timestamp) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_timestamptz_ops USING gist ADD
- FUNCTION 12 (timestamptz, timestamptz) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_time_ops USING gist ADD
- FUNCTION 12 (time, time) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_date_ops USING gist ADD
- FUNCTION 12 (date, date) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_interval_ops USING gist ADD
- FUNCTION 12 (interval, interval) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_cash_ops USING gist ADD
- FUNCTION 12 (money, money) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_macaddr_ops USING gist ADD
- FUNCTION 12 (macaddr, macaddr) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_text_ops USING gist ADD
- FUNCTION 12 (text, text) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_bpchar_ops USING gist ADD
- FUNCTION 12 (bpchar, bpchar) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_bytea_ops USING gist ADD
- FUNCTION 12 (bytea, bytea) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_numeric_ops USING gist ADD
- FUNCTION 12 (numeric, numeric) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_bit_ops USING gist ADD
- FUNCTION 12 (bit, bit) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_vbit_ops USING gist ADD
- FUNCTION 12 (varbit, varbit) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_inet_ops USING gist ADD
- FUNCTION 12 (inet, inet) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_cidr_ops USING gist ADD
- FUNCTION 12 (cidr, cidr) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_timetz_ops USING gist ADD
- FUNCTION 12 (timetz, timetz) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_uuid_ops USING gist ADD
- FUNCTION 12 (uuid, uuid) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_macaddr8_ops USING gist ADD
- FUNCTION 12 (macaddr8, macaddr8) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_enum_ops USING gist ADD
- FUNCTION 12 (anyenum, anyenum) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
ALTER OPERATOR FAMILY gist_bool_ops USING gist ADD
- FUNCTION 12 (bool, bool) gist_stratnum_btree (int) ;
+ FUNCTION 12 ("any", "any") gist_stratnum_btree (int) ;
diff --git a/doc/src/sgml/gist.sgml b/doc/src/sgml/gist.sgml
index 99098ab2522..9af5a4805f6 100644
--- a/doc/src/sgml/gist.sgml
+++ b/doc/src/sgml/gist.sgml
@@ -1197,6 +1197,12 @@ <title>Extensibility</title>
RETURNS smallint
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
+</programlisting>
+
+ And the operator family registration must look like this:
+<programlisting>
+ALTER OPERATOR FAMILY my_opfamily USING gist ADD
+ FUNCTION 12 ("any", "any") my_stratnum(int);
</programlisting>
</para>
diff --git a/src/backend/access/gist/gistutil.c
b/src/backend/access/gist/gistutil.c
index dbc4ac639a2..fef5876d7d8 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -1101,7 +1101,7 @@ gisttranslatecmptype(CompareType cmptype, Oid opfamily,
Oid opcintype)
Datum result;
/* Check whether the function is provided. */
- funcid = get_opfamily_proc(opfamily, opcintype, opcintype,
GIST_STRATNUM_PROC);
+ funcid = get_opfamily_proc(opfamily, ANYOID, ANYOID,
GIST_STRATNUM_PROC);
if (!OidIsValid(funcid))
return InvalidStrategy;
diff --git a/src/backend/access/gist/gistvalidate.c
b/src/backend/access/gist/gistvalidate.c
index ffefa12d97a..2a49e6d20f0 100644
--- a/src/backend/access/gist/gistvalidate.c
+++ b/src/backend/access/gist/gistvalidate.c
@@ -140,7 +140,9 @@ gistvalidate(Oid opclassoid)
break;
case GIST_STRATNUM_PROC:
ok = check_amproc_signature(procform->amproc,
INT2OID, true,
-
1, 1, INT4OID);
+
1, 1, INT4OID) &&
+ procform->amproclefttype == ANYOID &&
+ procform->amprocrighttype == ANYOID;
break;
default:
ereport(INFO,
diff --git a/src/include/catalog/pg_amproc.dat
b/src/include/catalog/pg_amproc.dat
index 508f48d345c..19100482ba4 100644
--- a/src/include/catalog/pg_amproc.dat
+++ b/src/include/catalog/pg_amproc.dat
@@ -506,8 +506,8 @@
amprocrighttype => 'box', amprocnum => '7', amproc => 'gist_box_same' },
{ amprocfamily => 'gist/box_ops', amproclefttype => 'box',
amprocrighttype => 'box', amprocnum => '8', amproc => 'gist_box_distance' },
-{ amprocfamily => 'gist/box_ops', amproclefttype => 'box',
- amprocrighttype => 'box', amprocnum => '12',
+{ amprocfamily => 'gist/box_ops', amproclefttype => 'any',
+ amprocrighttype => 'any', amprocnum => '12',
amproc => 'gist_stratnum_common' },
{ amprocfamily => 'gist/poly_ops', amproclefttype => 'polygon',
amprocrighttype => 'polygon', amprocnum => '1',
@@ -528,8 +528,8 @@
{ amprocfamily => 'gist/poly_ops', amproclefttype => 'polygon',
amprocrighttype => 'polygon', amprocnum => '8',
amproc => 'gist_poly_distance' },
-{ amprocfamily => 'gist/poly_ops', amproclefttype => 'polygon',
- amprocrighttype => 'polygon', amprocnum => '12',
+{ amprocfamily => 'gist/poly_ops', amproclefttype => 'any',
+ amprocrighttype => 'any', amprocnum => '12',
amproc => 'gist_stratnum_common' },
{ amprocfamily => 'gist/circle_ops', amproclefttype => 'circle',
amprocrighttype => 'circle', amprocnum => '1',
@@ -549,8 +549,8 @@
{ amprocfamily => 'gist/circle_ops', amproclefttype => 'circle',
amprocrighttype => 'circle', amprocnum => '8',
amproc => 'gist_circle_distance' },
-{ amprocfamily => 'gist/circle_ops', amproclefttype => 'circle',
- amprocrighttype => 'circle', amprocnum => '12',
+{ amprocfamily => 'gist/circle_ops', amproclefttype => 'any',
+ amprocrighttype => 'any', amprocnum => '12',
amproc => 'gist_stratnum_common' },
{ amprocfamily => 'gist/tsvector_ops', amproclefttype => 'tsvector',
amprocrighttype => 'tsvector', amprocnum => '1',
@@ -606,8 +606,8 @@
{ amprocfamily => 'gist/range_ops', amproclefttype => 'anyrange',
amprocrighttype => 'anyrange', amprocnum => '7',
amproc => 'range_gist_same' },
-{ amprocfamily => 'gist/range_ops', amproclefttype => 'anyrange',
- amprocrighttype => 'anyrange', amprocnum => '12',
+{ amprocfamily => 'gist/range_ops', amproclefttype => 'any',
+ amprocrighttype => 'any', amprocnum => '12',
amproc => 'gist_stratnum_common' },
{ amprocfamily => 'gist/network_ops', amproclefttype => 'inet',
amprocrighttype => 'inet', amprocnum => '1',
@@ -625,8 +625,8 @@
amprocrighttype => 'inet', amprocnum => '7', amproc => 'inet_gist_same' },
{ amprocfamily => 'gist/network_ops', amproclefttype => 'inet',
amprocrighttype => 'inet', amprocnum => '9', amproc => 'inet_gist_fetch' },
-{ amprocfamily => 'gist/network_ops', amproclefttype => 'inet',
- amprocrighttype => 'inet', amprocnum => '12',
+{ amprocfamily => 'gist/network_ops', amproclefttype => 'any',
+ amprocrighttype => 'any', amprocnum => '12',
amproc => 'gist_stratnum_common' },
{ amprocfamily => 'gist/multirange_ops', amproclefttype => 'anymultirange',
amprocrighttype => 'anymultirange', amprocnum => '1',
@@ -646,8 +646,8 @@
{ amprocfamily => 'gist/multirange_ops', amproclefttype => 'anymultirange',
amprocrighttype => 'anymultirange', amprocnum => '7',
amproc => 'range_gist_same' },
-{ amprocfamily => 'gist/multirange_ops', amproclefttype => 'anymultirange',
- amprocrighttype => 'anymultirange', amprocnum => '12',
+{ amprocfamily => 'gist/multirange_ops', amproclefttype => 'any',
+ amprocrighttype => 'any', amprocnum => '12',
amproc => 'gist_stratnum_common' },
# gin
--
2.48.1
From 6f5be36bb6b25776b54fccf01387c405baafa557 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Fri, 7 Feb 2025 16:06:18 +0100
Subject: [PATCH v19.4 2/2] Drop opcintype from index AM strategy translation
API
---
src/backend/access/gist/gistutil.c | 2 +-
src/backend/access/hash/hash.c | 4 ++--
src/backend/access/index/amapi.c | 8 ++++----
src/backend/access/nbtree/nbtree.c | 4 ++--
src/backend/catalog/index.c | 1 -
src/backend/commands/indexcmds.c | 2 +-
src/backend/commands/tablecmds.c | 2 +-
src/backend/executor/execReplication.c | 2 +-
src/backend/replication/logical/relation.c | 6 ++----
src/include/access/amapi.h | 8 ++++----
src/include/access/gist.h | 2 +-
src/include/access/hash.h | 4 ++--
src/include/access/nbtree.h | 4 ++--
13 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/src/backend/access/gist/gistutil.c
b/src/backend/access/gist/gistutil.c
index fef5876d7d8..a6b701943d3 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -1095,7 +1095,7 @@ gist_stratnum_common(PG_FUNCTION_ARGS)
* Returns InvalidStrategy if the function is not defined.
*/
StrategyNumber
-gisttranslatecmptype(CompareType cmptype, Oid opfamily, Oid opcintype)
+gisttranslatecmptype(CompareType cmptype, Oid opfamily)
{
Oid funcid;
Datum result;
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index 63b568e7f24..8b0d321cf21 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -927,7 +927,7 @@ hashbucketcleanup(Relation rel, Bucket cur_bucket, Buffer
bucket_buf,
}
CompareType
-hashtranslatestrategy(StrategyNumber strategy, Oid opfamily, Oid opcintype)
+hashtranslatestrategy(StrategyNumber strategy, Oid opfamily)
{
if (strategy == HTEqualStrategyNumber)
return COMPARE_EQ;
@@ -935,7 +935,7 @@ hashtranslatestrategy(StrategyNumber strategy, Oid
opfamily, Oid opcintype)
}
StrategyNumber
-hashtranslatecmptype(CompareType cmptype, Oid opfamily, Oid opcintype)
+hashtranslatecmptype(CompareType cmptype, Oid opfamily)
{
if (cmptype == COMPARE_EQ)
return HTEqualStrategyNumber;
diff --git a/src/backend/access/index/amapi.c b/src/backend/access/index/amapi.c
index 5f53f49ec32..d6b8dad4d52 100644
--- a/src/backend/access/index/amapi.c
+++ b/src/backend/access/index/amapi.c
@@ -115,14 +115,14 @@ GetIndexAmRoutineByAmId(Oid amoid, bool noerror)
* true, just return COMPARE_INVALID.
*/
CompareType
-IndexAmTranslateStrategy(StrategyNumber strategy, Oid amoid, Oid opfamily, Oid
opcintype, bool missing_ok)
+IndexAmTranslateStrategy(StrategyNumber strategy, Oid amoid, Oid opfamily,
bool missing_ok)
{
CompareType result;
IndexAmRoutine *amroutine;
amroutine = GetIndexAmRoutineByAmId(amoid, false);
if (amroutine->amtranslatestrategy)
- result = amroutine->amtranslatestrategy(strategy, opfamily,
opcintype);
+ result = amroutine->amtranslatestrategy(strategy, opfamily);
else
result = COMPARE_INVALID;
@@ -140,14 +140,14 @@ IndexAmTranslateStrategy(StrategyNumber strategy, Oid
amoid, Oid opfamily, Oid o
* to the given cmptype. If true, just return InvalidStrategy.
*/
StrategyNumber
-IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, Oid
opcintype, bool missing_ok)
+IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool
missing_ok)
{
StrategyNumber result;
IndexAmRoutine *amroutine;
amroutine = GetIndexAmRoutineByAmId(amoid, false);
if (amroutine->amtranslatecmptype)
- result = amroutine->amtranslatecmptype(cmptype, opfamily,
opcintype);
+ result = amroutine->amtranslatecmptype(cmptype, opfamily);
else
result = InvalidStrategy;
diff --git a/src/backend/access/nbtree/nbtree.c
b/src/backend/access/nbtree/nbtree.c
index 971405e89af..22ca35530d2 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -1513,7 +1513,7 @@ btgettreeheight(Relation rel)
}
CompareType
-bttranslatestrategy(StrategyNumber strategy, Oid opfamily, Oid opcintype)
+bttranslatestrategy(StrategyNumber strategy, Oid opfamily)
{
switch (strategy)
{
@@ -1533,7 +1533,7 @@ bttranslatestrategy(StrategyNumber strategy, Oid
opfamily, Oid opcintype)
}
StrategyNumber
-bttranslatecmptype(CompareType cmptype, Oid opfamily, Oid opcintype)
+bttranslatecmptype(CompareType cmptype, Oid opfamily)
{
switch (cmptype)
{
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index cdabf780244..f37b990c81d 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -2692,7 +2692,6 @@ BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii)
IndexAmTranslateCompareType(COMPARE_EQ,
index->rd_rel->relam,
index->rd_opfamily[i],
-
index->rd_opcintype[i],
false);
ii->ii_UniqueOps[i] =
get_opfamily_member(index->rd_opfamily[i],
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index f8d3ea820e1..c92f5620ec1 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -2468,7 +2468,7 @@ GetOperatorFromCompareType(Oid opclass, Oid rhstype,
CompareType cmptype,
/*
* Ask the index AM to translate to its internal stratnum
*/
- *strat = IndexAmTranslateCompareType(cmptype, amid, opfamily,
opcintype, true);
+ *strat = IndexAmTranslateCompareType(cmptype, amid, opfamily,
true);
if (*strat == InvalidStrategy)
ereport(ERROR,
errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 5823fce9340..1aa7e6ecd9e 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -10112,7 +10112,7 @@ ATAddForeignKeyConstraint(List **wqueue,
AlteredTableInfo *tab, Relation rel,
*/
for_overlaps = with_period && i == numpks - 1;
cmptype = for_overlaps ? COMPARE_OVERLAP : COMPARE_EQ;
- eqstrategy = IndexAmTranslateCompareType(cmptype, amid,
opfamily, opcintype, true);
+ eqstrategy = IndexAmTranslateCompareType(cmptype, amid,
opfamily, true);
if (eqstrategy == InvalidStrategy)
ereport(ERROR,
errcode(ERRCODE_UNDEFINED_OBJECT),
diff --git a/src/backend/executor/execReplication.c
b/src/backend/executor/execReplication.c
index 5f7613cc831..5cef54f00ed 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -91,7 +91,7 @@ build_replindex_scan_key(ScanKey skey, Relation rel, Relation
idxrel,
*/
optype = get_opclass_input_type(opclass->values[index_attoff]);
opfamily = get_opclass_family(opclass->values[index_attoff]);
- eq_strategy = IndexAmTranslateCompareType(COMPARE_EQ,
idxrel->rd_rel->relam, opfamily, optype, false);
+ eq_strategy = IndexAmTranslateCompareType(COMPARE_EQ,
idxrel->rd_rel->relam, opfamily, false);
operator = get_opfamily_member(opfamily, optype,
optype,
eq_strategy);
diff --git a/src/backend/replication/logical/relation.c
b/src/backend/replication/logical/relation.c
index e9ad90d64a5..46d15b824e3 100644
--- a/src/backend/replication/logical/relation.c
+++ b/src/backend/replication/logical/relation.c
@@ -837,11 +837,9 @@ IsIndexUsableForReplicaIdentityFull(Relation idxrel,
AttrMap *attrmap)
for (int i = 0; i < idxrel->rd_index->indnkeyatts; i++)
{
Oid opfamily;
- Oid opcintype;
- if (!get_opclass_opfamily_and_input_type(indclass->values[i],
&opfamily, &opcintype))
- return false;
- if (IndexAmTranslateCompareType(COMPARE_EQ,
idxrel->rd_rel->relam, opfamily, opcintype, true) == InvalidStrategy)
+ opfamily = get_opclass_family(indclass->values[i]);
+ if (IndexAmTranslateCompareType(COMPARE_EQ,
idxrel->rd_rel->relam, opfamily, true) == InvalidStrategy)
return false;
}
diff --git a/src/include/access/amapi.h b/src/include/access/amapi.h
index 6723de75a4d..fbe6b225ec9 100644
--- a/src/include/access/amapi.h
+++ b/src/include/access/amapi.h
@@ -102,10 +102,10 @@ typedef struct OpFamilyMember
*/
/* translate AM-specific strategies to general operator types */
-typedef CompareType (*amtranslate_strategy_function) (StrategyNumber strategy,
Oid opfamily, Oid opcintype);
+typedef CompareType (*amtranslate_strategy_function) (StrategyNumber strategy,
Oid opfamily);
/* translate general operator types to AM-specific strategies */
-typedef StrategyNumber (*amtranslate_cmptype_function) (CompareType cmptype,
Oid opfamily, Oid opcintype);
+typedef StrategyNumber (*amtranslate_cmptype_function) (CompareType cmptype,
Oid opfamily);
/* build new index */
typedef IndexBuildResult *(*ambuild_function) (Relation heapRelation,
@@ -319,7 +319,7 @@ typedef struct IndexAmRoutine
/* Functions in access/index/amapi.c */
extern IndexAmRoutine *GetIndexAmRoutine(Oid amhandler);
extern IndexAmRoutine *GetIndexAmRoutineByAmId(Oid amoid, bool noerror);
-extern CompareType IndexAmTranslateStrategy(StrategyNumber strategy, Oid
amoid, Oid opfamily, Oid opcintype, bool missing_ok);
-extern StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid
amoid, Oid opfamily, Oid opcintype, bool missing_ok);
+extern CompareType IndexAmTranslateStrategy(StrategyNumber strategy, Oid
amoid, Oid opfamily, bool missing_ok);
+extern StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid
amoid, Oid opfamily, bool missing_ok);
#endif /* AMAPI_H */
diff --git a/src/include/access/gist.h b/src/include/access/gist.h
index db62a9ac0b4..db78e60eeab 100644
--- a/src/include/access/gist.h
+++ b/src/include/access/gist.h
@@ -248,6 +248,6 @@ typedef struct
do { (e).key = (k); (e).rel = (r); (e).page = (pg); \
(e).offset = (o); (e).leafkey = (l); } while (0)
-extern StrategyNumber gisttranslatecmptype(CompareType cmptype, Oid opfamily,
Oid opcintype);
+extern StrategyNumber gisttranslatecmptype(CompareType cmptype, Oid opfamily);
#endif /* GIST_H */
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index e91f2b00ad9..073ad29b19b 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -387,8 +387,8 @@ extern void hashadjustmembers(Oid opfamilyoid,
List *operators,
List *functions);
-extern CompareType hashtranslatestrategy(StrategyNumber strategy, Oid
opfamily, Oid opcintype);
-extern StrategyNumber hashtranslatecmptype(CompareType cmptype, Oid opfamily,
Oid opcintype);
+extern CompareType hashtranslatestrategy(StrategyNumber strategy, Oid
opfamily);
+extern StrategyNumber hashtranslatecmptype(CompareType cmptype, Oid opfamily);
/* private routines */
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index 000c7289b80..e4fdeca3402 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -1183,8 +1183,8 @@ extern IndexBulkDeleteResult
*btvacuumcleanup(IndexVacuumInfo *info,
extern bool btcanreturn(Relation index, int attno);
extern int btgettreeheight(Relation rel);
-extern CompareType bttranslatestrategy(StrategyNumber strategy, Oid opfamily,
Oid opcintype);
-extern StrategyNumber bttranslatecmptype(CompareType cmptype, Oid opfamily,
Oid opcintype);
+extern CompareType bttranslatestrategy(StrategyNumber strategy, Oid opfamily);
+extern StrategyNumber bttranslatecmptype(CompareType cmptype, Oid opfamily);
/*
* prototypes for internal functions in nbtree.c
--
2.48.1