mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
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 >.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.115 2002/04/05 00:31:26 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.116 2002/04/16 23:08:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "access/nbtree.h"
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/pg_amop.h"
|
||||
#include "catalog/pg_namespace.h"
|
||||
#include "catalog/pg_operator.h"
|
||||
#include "executor/executor.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
@@ -911,7 +912,8 @@ indexable_operator(Expr *clause, Oid opclass, bool indexkey_on_left)
|
||||
* operator, but in practice that seems pretty unlikely for
|
||||
* binary-compatible types.)
|
||||
*/
|
||||
new_op = compatible_oper_opid(opname, indexkeytype, indexkeytype, true);
|
||||
new_op = compatible_oper_opid(makeList1(makeString(opname)),
|
||||
indexkeytype, indexkeytype, true);
|
||||
|
||||
if (OidIsValid(new_op))
|
||||
{
|
||||
@@ -2143,14 +2145,15 @@ network_prefix_quals(Var *leftop, Oid expr_op, Datum rightop)
|
||||
*/
|
||||
|
||||
/* See if there is a binary op of the given name for the given datatype */
|
||||
/* NB: we assume that only built-in system operators are searched for */
|
||||
static Oid
|
||||
find_operator(const char *opname, Oid datatype)
|
||||
{
|
||||
return GetSysCacheOid(OPERNAME,
|
||||
return GetSysCacheOid(OPERNAMENSP,
|
||||
PointerGetDatum(opname),
|
||||
ObjectIdGetDatum(datatype),
|
||||
ObjectIdGetDatum(datatype),
|
||||
CharGetDatum('b'));
|
||||
ObjectIdGetDatum(PG_CATALOG_NAMESPACE));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.67 2002/03/12 00:51:45 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.68 2002/04/16 23:08:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -740,7 +740,8 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
|
||||
*/
|
||||
ltype = exprType(item1);
|
||||
rtype = exprType(item2);
|
||||
eq_operator = compatible_oper("=", ltype, rtype, true);
|
||||
eq_operator = compatible_oper(makeList1(makeString("=")),
|
||||
ltype, rtype, true);
|
||||
if (!HeapTupleIsValid(eq_operator))
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.50 2001/11/30 19:24:15 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.51 2002/04/16 23:08:11 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -284,9 +284,9 @@ make_subplan(SubLink *slink)
|
||||
* Note: we use make_operand in case runtime type conversion
|
||||
* function calls must be inserted for this operator!
|
||||
*/
|
||||
left = make_operand("", lefthand,
|
||||
left = make_operand(lefthand,
|
||||
exprType(lefthand), opform->oprleft);
|
||||
right = make_operand("", (Node *) prm,
|
||||
right = make_operand((Node *) prm,
|
||||
prm->paramtype, opform->oprright);
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
@@ -433,9 +433,9 @@ make_subplan(SubLink *slink)
|
||||
* Note: we use make_operand in case runtime type conversion
|
||||
* function calls must be inserted for this operator!
|
||||
*/
|
||||
left = make_operand("", lefthand,
|
||||
left = make_operand(lefthand,
|
||||
exprType(lefthand), opform->oprleft);
|
||||
right = make_operand("", (Node *) con,
|
||||
right = make_operand((Node *) con,
|
||||
con->consttype, opform->oprright);
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user