mirror of
https://github.com/postgres/postgres.git
synced 2025-10-15 05:46:52 +03:00
Rename amcancrosscompare
After more discussion about commit ce62f2f2a0
, rename the index AM
property amcancrosscompare to two separate properties
amconsistentequality and amconsistentordering. Also improve the
documentation and update some comments that were previously missed.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/E1tngY6-0000UL-2n%40gemulon.postgresql.org
This commit is contained in:
24
src/backend/utils/cache/lsyscache.c
vendored
24
src/backend/utils/cache/lsyscache.c
vendored
@@ -690,10 +690,11 @@ get_op_btree_interpretation(Oid opno)
|
||||
* semantics.
|
||||
*
|
||||
* This is trivially true if they are the same operator. Otherwise,
|
||||
* we look to see if they can be found in the same btree or hash opfamily.
|
||||
* Either finding allows us to assume that they have compatible notions
|
||||
* of equality. (The reason we need to do these pushups is that one might
|
||||
* be a cross-type operator; for instance int24eq vs int4eq.)
|
||||
* Otherwise, we look to see if they both belong to an opfamily that
|
||||
* guarantees compatible semantics for equality. Either finding allows us to
|
||||
* assume that they have compatible notions of equality. (The reason we need
|
||||
* to do these pushups is that one might be a cross-type operator; for
|
||||
* instance int24eq vs int4eq.)
|
||||
*/
|
||||
bool
|
||||
equality_ops_are_compatible(Oid opno1, Oid opno2)
|
||||
@@ -718,7 +719,7 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
|
||||
Form_pg_amop op_form = (Form_pg_amop) GETSTRUCT(op_tuple);
|
||||
IndexAmRoutine *amroutine = GetIndexAmRoutineByAmId(op_form->amopmethod, false);
|
||||
|
||||
if (amroutine->amcancrosscompare)
|
||||
if (amroutine->amconsistentequality)
|
||||
{
|
||||
if (op_in_opfamily(opno2, op_form->amopfamily))
|
||||
{
|
||||
@@ -738,12 +739,13 @@ equality_ops_are_compatible(Oid opno1, Oid opno2)
|
||||
* Return true if the two given comparison operators have compatible
|
||||
* semantics.
|
||||
*
|
||||
* This is trivially true if they are the same operator. Otherwise,
|
||||
* we look to see if they can be found in the same btree opfamily.
|
||||
* For example, '<' and '>=' ops match if they belong to the same family.
|
||||
* This is trivially true if they are the same operator. Otherwise, we look
|
||||
* to see if they both belong to an opfamily that guarantees compatible
|
||||
* semantics for ordering. (For example, for btree, '<' and '>=' ops match if
|
||||
* they belong to the same family.)
|
||||
*
|
||||
* (This is identical to equality_ops_are_compatible(), except that we
|
||||
* don't bother to examine hash opclasses.)
|
||||
* (This is identical to equality_ops_are_compatible(), except that we check
|
||||
* amcanorder plus amconsistentordering instead of amconsistentequality.)
|
||||
*/
|
||||
bool
|
||||
comparison_ops_are_compatible(Oid opno1, Oid opno2)
|
||||
@@ -768,7 +770,7 @@ comparison_ops_are_compatible(Oid opno1, Oid opno2)
|
||||
Form_pg_amop op_form = (Form_pg_amop) GETSTRUCT(op_tuple);
|
||||
IndexAmRoutine *amroutine = GetIndexAmRoutineByAmId(op_form->amopmethod, false);
|
||||
|
||||
if (amroutine->amcanorder && amroutine->amcancrosscompare)
|
||||
if (amroutine->amcanorder && amroutine->amconsistentordering)
|
||||
{
|
||||
if (op_in_opfamily(opno2, op_form->amopfamily))
|
||||
{
|
||||
|
Reference in New Issue
Block a user