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/parser/parse_clause.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/parser/parse_clause.c')
-rw-r--r-- | src/backend/parser/parse_clause.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index 4177e7887e1..452f66284d8 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.88 2002/04/15 06:05:49 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.89 2002/04/16 23:08:11 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ static Node *transformFromClauseItem(ParseState *pstate, Node *n, static TargetEntry *findTargetlistEntry(ParseState *pstate, Node *node, List *tlist, int clause); static List *addTargetToSortList(TargetEntry *tle, List *sortlist, - List *targetlist, char *opname); + List *targetlist, List *opname); static bool exprIsInSortList(Node *expr, List *sortList, List *targetList); @@ -257,22 +257,15 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars) Node *rvar = (Node *) lfirst(rvars); A_Expr *e; - e = makeNode(A_Expr); - e->oper = OP; - e->opname = "="; - e->lexpr = copyObject(lvar); - e->rexpr = copyObject(rvar); + e = makeSimpleA_Expr(OP, "=", copyObject(lvar), copyObject(rvar)); if (result == NULL) result = (Node *) e; else { - A_Expr *a = makeNode(A_Expr); + A_Expr *a; - a->oper = AND; - a->opname = NULL; - a->lexpr = result; - a->rexpr = (Node *) e; + a = makeA_Expr(AND, NIL, result, (Node *) e); result = (Node *) a; } @@ -1117,7 +1110,7 @@ transformDistinctClause(ParseState *pstate, List *distinctlist, else { *sortClause = addTargetToSortList(tle, *sortClause, - targetlist, NULL); + targetlist, NIL); /* * Probably, the tle should always have been added at the @@ -1160,7 +1153,7 @@ addAllTargetsToSortList(List *sortlist, List *targetlist) TargetEntry *tle = (TargetEntry *) lfirst(i); if (!tle->resdom->resjunk) - sortlist = addTargetToSortList(tle, sortlist, targetlist, NULL); + sortlist = addTargetToSortList(tle, sortlist, targetlist, NIL); } return sortlist; } @@ -1169,13 +1162,13 @@ addAllTargetsToSortList(List *sortlist, List *targetlist) * addTargetToSortList * If the given targetlist entry isn't already in the ORDER BY list, * add it to the end of the list, using the sortop with given name - * or any available sort operator if opname == NULL. + * or any available sort operator if opname == NIL. * * Returns the updated ORDER BY list. */ static List * addTargetToSortList(TargetEntry *tle, List *sortlist, List *targetlist, - char *opname) + List *opname) { /* avoid making duplicate sortlist entries */ if (!exprIsInSortList(tle->expr, sortlist, targetlist)) |