From 6cef5d2549110c6c0abb92215c2593e652024493 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 16 Apr 2002 23:08:12 +0000 Subject: Operators live in namespaces. CREATE/DROP/COMMENT ON OPERATOR take qualified operator names directly, for example CREATE OPERATOR myschema.+ ( ... ). To qualify an operator name in an expression you need to write OPERATOR(myschema.+) (thanks to Peter for suggesting an escape hatch). I also took advantage of having to reformat pg_operator to fix something that'd been bugging me for a while: mergejoinable operators should have explicit links to the associated cross-data-type comparison operators, rather than hardwiring an assumption that they are named < and >. --- src/backend/utils/adt/ri_triggers.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/backend/utils/adt/ri_triggers.c') diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index f9accfefc2..e0b465ec98 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -18,7 +18,7 @@ * Portions Copyright (c) 2000-2001, PostgreSQL Global Development Group * Copyright 1999 Jan Wieck * - * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.36 2002/04/02 01:03:07 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.37 2002/04/16 23:08:11 tgl Exp $ * * ---------- */ @@ -36,6 +36,7 @@ #include "catalog/pg_operator.h" #include "commands/trigger.h" #include "executor/spi_priv.h" +#include "parser/parse_oper.h" #include "utils/lsyscache.h" #include "miscadmin.h" @@ -3338,27 +3339,20 @@ ri_AttributesEqual(Oid typeid, Datum oldvalue, Datum newvalue) HASH_FIND, NULL); /* - * If not found, lookup the OPERNAME system cache for it to get the - * func OID, then do the function manager lookup, and remember that - * info. + * If not found, lookup the operator, then do the function manager + * lookup, and remember that info. */ if (!entry) { - HeapTuple opr_tup; Oid opr_proc; FmgrInfo finfo; - opr_tup = SearchSysCache(OPERNAME, - PointerGetDatum("="), - ObjectIdGetDatum(typeid), - ObjectIdGetDatum(typeid), - CharGetDatum('b')); - if (!HeapTupleIsValid(opr_tup)) + opr_proc = compatible_oper_funcid(makeList1(makeString("=")), + typeid, typeid, true); + if (!OidIsValid(opr_proc)) elog(ERROR, - "ri_AttributesEqual(): cannot find '=' operator for type %u", + "ri_AttributesEqual(): cannot find '=' operator for type %u", typeid); - opr_proc = ((Form_pg_operator) GETSTRUCT(opr_tup))->oprcode; - ReleaseSysCache(opr_tup); /* * Since fmgr_info could fail, call it *before* creating the -- cgit v1.2.1