summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorPeter Eisentraut2025-01-15 10:28:39 +0000
committerPeter Eisentraut2025-01-15 10:34:04 +0000
commit630f9a43cece93cb4a5c243b30e34abce6a89514 (patch)
treeef3a4a65f971bd526919b0ee67fad92bb4590ef9 /doc/src
parent6339f6468e8217f556e38482626250dc72d7cd00 (diff)
Change gist stratnum function to use CompareType
This changes commit 7406ab623fe in that the gist strategy number mapping support function is changed to use the CompareType enum as input, instead of the "well-known" RT*StrategyNumber strategy numbers. This is a bit cleaner, since you are not dealing with two sets of strategy numbers. Also, this will enable us to subsume this system into a more general system of using CompareType to define operator semantics across index methods. Discussion: https://www.postgresql.org/message-id/flat/[email protected]
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/gist.sgml24
-rw-r--r--doc/src/sgml/xindex.sgml2
2 files changed, 13 insertions, 13 deletions
diff --git a/doc/src/sgml/gist.sgml b/doc/src/sgml/gist.sgml
index 638d912dc2d..99098ab2522 100644
--- a/doc/src/sgml/gist.sgml
+++ b/doc/src/sgml/gist.sgml
@@ -290,8 +290,8 @@ CREATE INDEX ON my_table USING GIST (my_inet_column inet_ops);
The optional eleventh method <function>sortsupport</function> is used to
speed up building a <acronym>GiST</acronym> index.
The optional twelfth method <function>stratnum</function> is used to
- translate well-known <literal>RT*StrategyNumber</literal>s (from
- <filename>src/include/access/stratnum.h</filename>) into strategy numbers
+ translate compare types (from
+ <filename>src/include/nodes/primnodes.h</filename>) into strategy numbers
used by the operator class. This lets the core code look up operators for
temporal constraint indexes.
</para>
@@ -1173,8 +1173,8 @@ my_sortsupport(PG_FUNCTION_ARGS)
<term><function>stratnum</function></term>
<listitem>
<para>
- Given an <literal>RT*StrategyNumber</literal> value from
- <filename>src/include/access/stratnum.h</filename>, returns a strategy
+ Given a <literal>CompareType</literal> value from
+ <filename>src/include/nodes/primnodes.h</filename>, returns a strategy
number used by this operator class for matching functionality. The
function should return <literal>InvalidStrategy</literal> if the
operator class has no matching strategy.
@@ -1184,7 +1184,7 @@ my_sortsupport(PG_FUNCTION_ARGS)
This is used for temporal index constraints (i.e., <literal>PRIMARY
KEY</literal> and <literal>UNIQUE</literal>). If the operator class
provides this function and it returns results for
- <literal>RTEqualStrategyNumber</literal>, it can be used in the
+ <literal>COMPARE_EQ</literal>, it can be used in the
non-<literal>WITHOUT OVERLAPS</literal> part(s) of an index constraint.
</para>
@@ -1194,7 +1194,7 @@ my_sortsupport(PG_FUNCTION_ARGS)
<programlisting>
CREATE OR REPLACE FUNCTION my_stratnum(integer)
-RETURNS integer
+RETURNS smallint
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;
</programlisting>
@@ -1209,12 +1209,12 @@ PG_FUNCTION_INFO_V1(my_stratnum);
Datum
my_stratnum(PG_FUNCTION_ARGS)
{
- StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(1);
+ CompareType cmptype = PG_GETARG_INT32(0);
StrategyNumber ret = InvalidStrategy;
- switch (strategy)
+ switch (cmptype)
{
- case RTEqualStrategyNumber:
+ case COMPARE_EQ:
ret = BTEqualStrategyNumber;
}
@@ -1226,9 +1226,9 @@ my_stratnum(PG_FUNCTION_ARGS)
<para>
One translation function is provided by
<productname>PostgreSQL</productname>:
- <literal>gist_stratnum_identity</literal> is for operator classes that
- already use the <literal>RT*StrategyNumber</literal> constants. It
- returns whatever is passed to it. The <literal>btree_gist</literal>
+ <literal>gist_stratnum_common</literal> is for operator classes that
+ use the <literal>RT*StrategyNumber</literal> constants.
+ The <literal>btree_gist</literal>
extension defines a second translation function,
<literal>gist_stratnum_btree</literal>, for operator classes that use
the <literal>BT*StrategyNumber</literal> constants.
diff --git a/doc/src/sgml/xindex.sgml b/doc/src/sgml/xindex.sgml
index 3a19dab15e0..05361962495 100644
--- a/doc/src/sgml/xindex.sgml
+++ b/doc/src/sgml/xindex.sgml
@@ -592,7 +592,7 @@
</row>
<row>
<entry><function>stratnum</function></entry>
- <entry>translate well-known strategy numbers to ones
+ <entry>translate compare types to strategy numbers
used by the operator class (optional)</entry>
<entry>12</entry>
</row>