summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/lsyscache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-11-12 21:15:59 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-11-12 21:15:59 +0000
commitfa5c8a055a02e44f446e4593e397c33a572c4d67 (patch)
tree9c0a7ded5a88c082c28dbe2b431660813abd72b8 /src/backend/utils/cache/lsyscache.c
parent49f98fa833407b4e4252e42522e640ec8a0d08b2 (diff)
Cross-data-type comparisons are now indexable by btrees, pursuant to my
pghackers proposal of 8-Nov. All the existing cross-type comparison operators (int2/int4/int8 and float4/float8) have appropriate support. The original proposal of storing the right-hand-side datatype as part of the primary key for pg_amop and pg_amproc got modified a bit in the event; it is easier to store zero as the 'default' case and only store a nonzero when the operator is actually cross-type. Along the way, remove the long-since-defunct bigbox_ops operator class.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r--src/backend/utils/cache/lsyscache.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index bed4fcdbce6..20c10802bc4 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.109 2003/11/09 21:30:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.110 2003/11/12 21:15:55 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -55,7 +55,7 @@ op_in_opclass(Oid opno, Oid opclass)
/*
* get_op_opclass_properties
*
- * Get the operator's strategy number and recheck (lossy) flag
+ * Get the operator's strategy number, subtype, and recheck (lossy) flag
* within the specified opclass.
*
* Caller should already have verified that opno is a member of opclass,
@@ -63,7 +63,7 @@ op_in_opclass(Oid opno, Oid opclass)
*/
void
get_op_opclass_properties(Oid opno, Oid opclass,
- int *strategy, bool *recheck)
+ int *strategy, Oid *subtype, bool *recheck)
{
HeapTuple tp;
Form_pg_amop amop_tup;
@@ -77,6 +77,7 @@ get_op_opclass_properties(Oid opno, Oid opclass,
opno, opclass);
amop_tup = (Form_pg_amop) GETSTRUCT(tp);
*strategy = amop_tup->amopstrategy;
+ *subtype = amop_tup->amopsubtype;
*recheck = amop_tup->amopreqcheck;
ReleaseSysCache(tp);
}
@@ -84,12 +85,12 @@ get_op_opclass_properties(Oid opno, Oid opclass,
/*
* get_opclass_member
* Get the OID of the operator that implements the specified strategy
- * for the specified opclass.
+ * with the specified subtype for the specified opclass.
*
* Returns InvalidOid if there is no pg_amop entry for the given keys.
*/
Oid
-get_opclass_member(Oid opclass, int16 strategy)
+get_opclass_member(Oid opclass, Oid subtype, int16 strategy)
{
HeapTuple tp;
Form_pg_amop amop_tup;
@@ -97,8 +98,9 @@ get_opclass_member(Oid opclass, int16 strategy)
tp = SearchSysCache(AMOPSTRATEGY,
ObjectIdGetDatum(opclass),
+ ObjectIdGetDatum(subtype),
Int16GetDatum(strategy),
- 0, 0);
+ 0);
if (!HeapTupleIsValid(tp))
return InvalidOid;
amop_tup = (Form_pg_amop) GETSTRUCT(tp);
@@ -149,8 +151,8 @@ get_op_hash_function(Oid opno)
if (OidIsValid(opclass))
{
- /* Found a suitable opclass, get its hash support function */
- return get_opclass_proc(opclass, HASHPROC);
+ /* Found a suitable opclass, get its default hash support function */
+ return get_opclass_proc(opclass, InvalidOid, HASHPROC);
}
/* Didn't find a match... */
@@ -163,12 +165,12 @@ get_op_hash_function(Oid opno)
/*
* get_opclass_proc
* Get the OID of the specified support function
- * for the specified opclass.
+ * for the specified opclass and subtype.
*
* Returns InvalidOid if there is no pg_amproc entry for the given keys.
*/
Oid
-get_opclass_proc(Oid opclass, int16 procnum)
+get_opclass_proc(Oid opclass, Oid subtype, int16 procnum)
{
HeapTuple tp;
Form_pg_amproc amproc_tup;
@@ -176,8 +178,9 @@ get_opclass_proc(Oid opclass, int16 procnum)
tp = SearchSysCache(AMPROCNUM,
ObjectIdGetDatum(opclass),
+ ObjectIdGetDatum(subtype),
Int16GetDatum(procnum),
- 0, 0);
+ 0);
if (!HeapTupleIsValid(tp))
return InvalidOid;
amproc_tup = (Form_pg_amproc) GETSTRUCT(tp);