diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-04-16 23:08:12 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-04-16 23:08:12 +0000 |
commit | 6cef5d2549110c6c0abb92215c2593e652024493 (patch) | |
tree | 7481a5b0bec7227c23f4b846cd7a1e40b47bf20e /src/backend/utils/adt/ri_triggers.c | |
parent | 4da51bfd6d89762f0a3cacde6edf1ac63c09349e (diff) | |
download | postgresql-6cef5d2549110c6c0abb92215c2593e652024493.tar.gz postgresql-6cef5d2549110c6c0abb92215c2593e652024493.zip |
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 >.
Diffstat (limited to 'src/backend/utils/adt/ri_triggers.c')
-rw-r--r-- | src/backend/utils/adt/ri_triggers.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index f9accfefc24..e0b465ec983 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 |