Skip to content

Commit 7d81364

Browse files
committed
more comments for fill_type_cmp_fmgr_info()
1 parent dc86c76 commit 7d81364

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/utils.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ fill_type_cmp_fmgr_info(FmgrInfo *finfo, Oid type1, Oid type2)
6767
TypeCacheEntry *tce_1,
6868
*tce_2;
6969

70+
/* Check type compatibility */
7071
if (IsBinaryCoercible(type1, type2))
7172
type1 = type2;
7273

@@ -76,6 +77,7 @@ fill_type_cmp_fmgr_info(FmgrInfo *finfo, Oid type1, Oid type2)
7677
tce_1 = lookup_type_cache(type1, TYPECACHE_BTREE_OPFAMILY);
7778
tce_2 = lookup_type_cache(type2, TYPECACHE_BTREE_OPFAMILY);
7879

80+
/* Both types should belong to the same opfamily */
7981
if (tce_1->btree_opf != tce_2->btree_opf)
8082
goto fill_type_cmp_fmgr_info_error;
8183

@@ -84,13 +86,16 @@ fill_type_cmp_fmgr_info(FmgrInfo *finfo, Oid type1, Oid type2)
8486
tce_2->btree_opintype,
8587
BTORDER_PROC);
8688

87-
if (cmp_proc_oid == InvalidOid)
89+
/* No such function, emit ERROR */
90+
if (!OidIsValid(cmp_proc_oid))
8891
goto fill_type_cmp_fmgr_info_error;
8992

93+
/* Fill FmgrInfo struct */
9094
fmgr_info(cmp_proc_oid, finfo);
9195

92-
return; /* exit safely */
96+
return; /* everything is OK */
9397

98+
/* Handle errors (no such function) */
9499
fill_type_cmp_fmgr_info_error:
95100
elog(ERROR, "missing comparison function for types %s & %s",
96101
format_type_be(type1), format_type_be(type2));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy