summaryrefslogtreecommitdiff
path: root/src/include/parser
diff options
context:
space:
mode:
authorTom Lane2002-04-16 23:08:12 +0000
committerTom Lane2002-04-16 23:08:12 +0000
commit6cef5d2549110c6c0abb92215c2593e652024493 (patch)
tree7481a5b0bec7227c23f4b846cd7a1e40b47bf20e /src/include/parser
parent4da51bfd6d89762f0a3cacde6edf1ac63c09349e (diff)
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/include/parser')
-rw-r--r--src/include/parser/parse_func.h12
-rw-r--r--src/include/parser/parse_node.h7
-rw-r--r--src/include/parser/parse_oper.h20
3 files changed, 17 insertions, 22 deletions
diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h
index e6353be34e7..17c618f0acf 100644
--- a/src/include/parser/parse_func.h
+++ b/src/include/parser/parse_func.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_func.h,v 1.39 2002/04/11 20:00:15 tgl Exp $
+ * $Id: parse_func.h,v 1.40 2002/04/16 23:08:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,16 +28,6 @@ typedef struct _InhPaths
Oid *supervec; /* vector of superclasses */
} InhPaths;
-/*
- * This structure holds a list of possible functions or operators that
- * agree with the known name and argument types of the function/operator.
- */
-typedef struct _CandidateList
-{
- Oid *args;
- struct _CandidateList *next;
-} *CandidateList;
-
/* Result codes for func_get_detail */
typedef enum
{
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index ecf67f8275b..8551000aca4 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_node.h,v 1.29 2001/11/05 17:46:35 momjian Exp $
+ * $Id: parse_node.h,v 1.30 2002/04/16 23:08:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,9 +51,8 @@ typedef struct ParseState
} ParseState;
extern ParseState *make_parsestate(ParseState *parentParseState);
-extern Expr *make_op(char *opname, Node *ltree, Node *rtree);
-extern Node *make_operand(char *opname, Node *tree,
- Oid orig_typeId, Oid target_typeId);
+extern Expr *make_op(List *opname, Node *ltree, Node *rtree);
+extern Node *make_operand(Node *tree, Oid orig_typeId, Oid target_typeId);
extern Var *make_var(ParseState *pstate, RangeTblEntry *rte, int attrno);
extern ArrayRef *transformArraySubscripts(ParseState *pstate,
Node *arrayBase,
diff --git a/src/include/parser/parse_oper.h b/src/include/parser/parse_oper.h
index c8f9abd1886..5793c16b311 100644
--- a/src/include/parser/parse_oper.h
+++ b/src/include/parser/parse_oper.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_oper.h,v 1.18 2001/11/05 17:46:35 momjian Exp $
+ * $Id: parse_oper.h,v 1.19 2002/04/16 23:08:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,25 +15,31 @@
#define PARSE_OPER_H
#include "access/htup.h"
+#include "nodes/parsenodes.h"
typedef HeapTuple Operator;
+/* Routines to look up an operator given name and exact input type(s) */
+extern Oid LookupOperName(List *opername, Oid oprleft, Oid oprright);
+extern Oid LookupOperNameTypeNames(List *opername, TypeName *oprleft,
+ TypeName *oprright, const char *caller);
+
/* Routines to find operators matching a name and given input types */
/* NB: the selected operator may require coercion of the input types! */
-extern Operator oper(char *op, Oid arg1, Oid arg2, bool noError);
-extern Operator right_oper(char *op, Oid arg);
-extern Operator left_oper(char *op, Oid arg);
+extern Operator oper(List *op, Oid arg1, Oid arg2, bool noError);
+extern Operator right_oper(List *op, Oid arg);
+extern Operator left_oper(List *op, Oid arg);
/* Routines to find operators that DO NOT require coercion --- ie, their */
/* input types are either exactly as given, or binary-compatible */
-extern Operator compatible_oper(char *op, Oid arg1, Oid arg2, bool noError);
+extern Operator compatible_oper(List *op, Oid arg1, Oid arg2, bool noError);
/* currently no need for compatible_left_oper/compatible_right_oper */
/* Convenience routines that call compatible_oper() and return either */
/* the operator OID or the underlying function OID, or InvalidOid if fail */
-extern Oid compatible_oper_opid(char *op, Oid arg1, Oid arg2, bool noError);
-extern Oid compatible_oper_funcid(char *op, Oid arg1, Oid arg2, bool noError);
+extern Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError);
+extern Oid compatible_oper_funcid(List *op, Oid arg1, Oid arg2, bool noError);
/* Convenience routine that packages a specific call on compatible_oper */
extern Oid any_ordering_op(Oid argtype);