mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +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:
@@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.177 2002/04/11 19:59:59 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.178 2002/04/16 23:08:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1526,8 +1526,7 @@ _copyAExpr(A_Expr *from)
|
||||
A_Expr *newnode = makeNode(A_Expr);
|
||||
|
||||
newnode->oper = from->oper;
|
||||
if (from->opname)
|
||||
newnode->opname = pstrdup(from->opname);
|
||||
Node_Copy(from, newnode, name);
|
||||
Node_Copy(from, newnode, lexpr);
|
||||
Node_Copy(from, newnode, rexpr);
|
||||
|
||||
@@ -1648,8 +1647,7 @@ _copySortGroupBy(SortGroupBy *from)
|
||||
{
|
||||
SortGroupBy *newnode = makeNode(SortGroupBy);
|
||||
|
||||
if (from->useOp)
|
||||
newnode->useOp = pstrdup(from->useOp);
|
||||
Node_Copy(from, newnode, useOp);
|
||||
Node_Copy(from, newnode, node);
|
||||
|
||||
return newnode;
|
||||
@@ -2128,7 +2126,7 @@ _copyRemoveOperStmt(RemoveOperStmt *from)
|
||||
{
|
||||
RemoveOperStmt *newnode = makeNode(RemoveOperStmt);
|
||||
|
||||
newnode->opname = pstrdup(from->opname);
|
||||
Node_Copy(from, newnode, opname);
|
||||
Node_Copy(from, newnode, args);
|
||||
|
||||
return newnode;
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.125 2002/04/11 19:59:59 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.126 2002/04/16 23:08:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -969,7 +969,7 @@ _equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
|
||||
static bool
|
||||
_equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b)
|
||||
{
|
||||
if (!equalstr(a->opname, b->opname))
|
||||
if (!equal(a->opname, b->opname))
|
||||
return false;
|
||||
if (!equal(a->args, b->args))
|
||||
return false;
|
||||
@@ -1400,7 +1400,7 @@ _equalAExpr(A_Expr *a, A_Expr *b)
|
||||
{
|
||||
if (a->oper != b->oper)
|
||||
return false;
|
||||
if (!equalstr(a->opname, b->opname))
|
||||
if (!equal(a->name, b->name))
|
||||
return false;
|
||||
if (!equal(a->lexpr, b->lexpr))
|
||||
return false;
|
||||
@@ -1520,7 +1520,7 @@ _equalTypeCast(TypeCast *a, TypeCast *b)
|
||||
static bool
|
||||
_equalSortGroupBy(SortGroupBy *a, SortGroupBy *b)
|
||||
{
|
||||
if (!equalstr(a->useOp, b->useOp))
|
||||
if (!equal(a->useOp, b->useOp))
|
||||
return false;
|
||||
if (!equal(a->node, b->node))
|
||||
return false;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.30 2002/03/29 19:06:09 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.31 2002/04/16 23:08:10 tgl Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
@@ -16,6 +16,39 @@
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
|
||||
/*
|
||||
* makeA_Expr -
|
||||
* makes an A_Expr node
|
||||
*/
|
||||
A_Expr *
|
||||
makeA_Expr(int oper, List *name, Node *lexpr, Node *rexpr)
|
||||
{
|
||||
A_Expr *a = makeNode(A_Expr);
|
||||
|
||||
a->oper = oper;
|
||||
a->name = name;
|
||||
a->lexpr = lexpr;
|
||||
a->rexpr = rexpr;
|
||||
return a;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeSimpleA_Expr -
|
||||
* As above, given a simple (unqualified) operator name
|
||||
*/
|
||||
A_Expr *
|
||||
makeSimpleA_Expr(int oper, const char *name,
|
||||
Node *lexpr, Node *rexpr)
|
||||
{
|
||||
A_Expr *a = makeNode(A_Expr);
|
||||
|
||||
a->oper = oper;
|
||||
a->name = makeList1(makeString((char *) name));
|
||||
a->lexpr = lexpr;
|
||||
a->rexpr = rexpr;
|
||||
return a;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeOper -
|
||||
* creates an Oper node
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.154 2002/04/11 19:59:59 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.155 2002/04/16 23:08:10 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||
@@ -1285,7 +1285,7 @@ _outAExpr(StringInfo str, A_Expr *node)
|
||||
appendStringInfo(str, "NOT ");
|
||||
break;
|
||||
case OP:
|
||||
_outToken(str, node->opname);
|
||||
_outNode(str, node->name);
|
||||
appendStringInfo(str, " ");
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user