diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-11-24 14:20:39 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-11-24 14:22:17 -0500 |
commit | 725d52d0c27cffe8c99bb78e2b0d2480d5cd702b (patch) | |
tree | 23aae31466c0f7e0e65762946b0012d30e92ab4d /src/backend/utils/cache | |
parent | 4fc09ad00c3cc95003a5523d85999da1dd4f9d75 (diff) | |
download | postgresql-725d52d0c27cffe8c99bb78e2b0d2480d5cd702b.tar.gz postgresql-725d52d0c27cffe8c99bb78e2b0d2480d5cd702b.zip |
Create the system catalog infrastructure needed for KNNGIST.
This commit adds columns amoppurpose and amopsortfamily to pg_amop, and
column amcanorderbyop to pg_am. For the moment all the entries in
amcanorderbyop are "false", since the underlying support isn't there yet.
Also, extend the CREATE OPERATOR CLASS/ALTER OPERATOR FAMILY commands with
[ FOR SEARCH | FOR ORDER BY sort_operator_family ] clauses to allow the new
columns of pg_amop to be populated, and create pg_dump support for dumping
that information.
I also added some documentation, although it's perhaps a bit premature
given that the feature doesn't do anything useful yet.
Teodor Sigaev, Robert Haas, Tom Lane
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 15 | ||||
-rw-r--r-- | src/backend/utils/cache/syscache.c | 4 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index df765e9d5e3..9beae0d9ef1 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -46,12 +46,15 @@ get_attavgwidth_hook_type get_attavgwidth_hook = NULL; * op_in_opfamily * * Return t iff operator 'opno' is in operator family 'opfamily'. + * + * This function only considers search operators, not ordering operators. */ bool op_in_opfamily(Oid opno, Oid opfamily) { - return SearchSysCacheExists2(AMOPOPID, + return SearchSysCacheExists3(AMOPOPID, ObjectIdGetDatum(opno), + CharGetDatum(AMOP_SEARCH), ObjectIdGetDatum(opfamily)); } @@ -60,6 +63,8 @@ op_in_opfamily(Oid opno, Oid opfamily) * * Get the operator's strategy number within the specified opfamily, * or 0 if it's not a member of the opfamily. + * + * This function only considers search operators, not ordering operators. */ int get_op_opfamily_strategy(Oid opno, Oid opfamily) @@ -68,8 +73,9 @@ get_op_opfamily_strategy(Oid opno, Oid opfamily) Form_pg_amop amop_tup; int result; - tp = SearchSysCache2(AMOPOPID, + tp = SearchSysCache3(AMOPOPID, ObjectIdGetDatum(opno), + CharGetDatum(AMOP_SEARCH), ObjectIdGetDatum(opfamily)); if (!HeapTupleIsValid(tp)) return 0; @@ -85,6 +91,8 @@ get_op_opfamily_strategy(Oid opno, Oid opfamily) * Get the operator's strategy number and declared input data types * within the specified opfamily. * + * This function only considers search operators, not ordering operators. + * * Caller should already have verified that opno is a member of opfamily, * therefore we raise an error if the tuple is not found. */ @@ -97,8 +105,9 @@ get_op_opfamily_properties(Oid opno, Oid opfamily, HeapTuple tp; Form_pg_amop amop_tup; - tp = SearchSysCache2(AMOPOPID, + tp = SearchSysCache3(AMOPOPID, ObjectIdGetDatum(opno), + CharGetDatum(AMOP_SEARCH), ObjectIdGetDatum(opfamily)); if (!HeapTupleIsValid(tp)) elog(ERROR, "operator %u is not a member of opfamily %u", diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index 94bef7dd018..08a14431b16 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -135,11 +135,11 @@ static const struct cachedesc cacheinfo[] = { }, {AccessMethodOperatorRelationId, /* AMOPOPID */ AccessMethodOperatorIndexId, - 2, + 3, { Anum_pg_amop_amopopr, + Anum_pg_amop_amoppurpose, Anum_pg_amop_amopfamily, - 0, 0 }, 64 |