提交 5f6a27f8 编写于 作者: T Tom Lane

Add missing copyfuncs/equalfuncs entries, including T_Null which has

been missing forever; surprising it wasn't noticed before.  The other
additions are, um, sloppiness in certain recent feature additions.
上级 6fb05e06
......@@ -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.201 2002/08/15 16:36:02 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.202 2002/08/19 00:11:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1568,7 +1568,26 @@ _copyAConst(A_Const *from)
{
A_Const *newnode = makeNode(A_Const);
newnode->val = *((Value *) (copyObject(&(from->val))));
/* This part must duplicate _copyValue */
newnode->val.type = from->val.type;
switch (from->val.type)
{
case T_Integer:
newnode->val.val.ival = from->val.val.ival;
break;
case T_Float:
case T_String:
case T_BitString:
newnode->val.val.str = pstrdup(from->val.val.str);
break;
case T_Null:
/* nothing to do */
break;
default:
elog(ERROR, "_copyAConst: unknown node type %d", from->val.type);
break;
}
Node_Copy(from, newnode, typename);
return newnode;
......@@ -2624,6 +2643,45 @@ _copyCreateSchemaStmt(CreateSchemaStmt *from)
return newnode;
}
static CreateConversionStmt *
_copyCreateConversionStmt(CreateConversionStmt *from)
{
CreateConversionStmt *newnode = makeNode(CreateConversionStmt);
Node_Copy(from, newnode, conversion_name);
newnode->for_encoding_name = pstrdup(from->for_encoding_name);
newnode->to_encoding_name = pstrdup(from->to_encoding_name);
Node_Copy(from, newnode, func_name);
newnode->def = from->def;
return newnode;
}
static CreateCastStmt *
_copyCreateCastStmt(CreateCastStmt *from)
{
CreateCastStmt *newnode = makeNode(CreateCastStmt);
Node_Copy(from, newnode, sourcetype);
Node_Copy(from, newnode, targettype);
Node_Copy(from, newnode, func);
newnode->implicit = from->implicit;
return newnode;
}
static DropCastStmt *
_copyDropCastStmt(DropCastStmt *from)
{
DropCastStmt *newnode = makeNode(DropCastStmt);
Node_Copy(from, newnode, sourcetype);
Node_Copy(from, newnode, targettype);
newnode->behavior = from->behavior;
return newnode;
}
/* ****************************************************************
* pg_list.h copy functions
......@@ -2635,6 +2693,8 @@ _copyValue(Value *from)
{
Value *newnode = makeNode(Value);
/* See also _copyAConst when changing this code! */
newnode->type = from->type;
switch (from->type)
{
......@@ -2646,7 +2706,11 @@ _copyValue(Value *from)
case T_BitString:
newnode->val.str = pstrdup(from->val.str);
break;
case T_Null:
/* nothing to do */
break;
default:
elog(ERROR, "_copyValue: unknown node type %d", from->type);
break;
}
return newnode;
......@@ -2839,6 +2903,7 @@ copyObject(void *from)
case T_Float:
case T_String:
case T_BitString:
case T_Null:
retval = _copyValue(from);
break;
case T_List:
......@@ -3043,6 +3108,15 @@ copyObject(void *from)
case T_CreateSchemaStmt:
retval = _copyCreateSchemaStmt(from);
break;
case T_CreateConversionStmt:
retval = _copyCreateConversionStmt(from);
break;
case T_CreateCastStmt:
retval = _copyCreateCastStmt(from);
break;
case T_DropCastStmt:
retval = _copyDropCastStmt(from);
break;
case T_A_Expr:
retval = _copyAExpr(from);
......
......@@ -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.150 2002/08/15 16:36:03 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.151 2002/08/19 00:11:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1459,6 +1459,51 @@ _equalCreateSchemaStmt(CreateSchemaStmt *a, CreateSchemaStmt *b)
return true;
}
static bool
_equalCreateConversionStmt(CreateConversionStmt *a, CreateConversionStmt *b)
{
if (!equal(a->conversion_name, b->conversion_name))
return false;
if (!equalstr(a->for_encoding_name, b->for_encoding_name))
return false;
if (!equalstr(a->to_encoding_name, b->to_encoding_name))
return false;
if (!equal(a->func_name, b->func_name))
return false;
if (a->def != b->def)
return false;
return true;
}
static bool
_equalCreateCastStmt(CreateCastStmt *a, CreateCastStmt *b)
{
if (!equal(a->sourcetype, b->sourcetype))
return false;
if (!equal(a->targettype, b->targettype))
return false;
if (!equal(a->func, b->func))
return false;
if (a->implicit != b->implicit)
return false;
return true;
}
static bool
_equalDropCastStmt(DropCastStmt *a, DropCastStmt *b)
{
if (!equal(a->sourcetype, b->sourcetype))
return false;
if (!equal(a->targettype, b->targettype))
return false;
if (a->behavior != b->behavior)
return false;
return true;
}
static bool
_equalAExpr(A_Expr *a, A_Expr *b)
{
......@@ -1881,7 +1926,11 @@ _equalValue(Value *a, Value *b)
case T_String:
case T_BitString:
return strcmp(a->val.str, b->val.str) == 0;
case T_Null:
/* nothing to do */
break;
default:
elog(ERROR, "_equalValue: unknown node type %d", a->type);
break;
}
......@@ -2028,10 +2077,12 @@ equal(void *a, void *b)
retval = true;
}
break;
case T_Integer:
case T_Float:
case T_String:
case T_BitString:
case T_Null:
retval = _equalValue(a, b);
break;
......@@ -2215,6 +2266,15 @@ equal(void *a, void *b)
case T_CreateSchemaStmt:
retval = _equalCreateSchemaStmt(a, b);
break;
case T_CreateConversionStmt:
retval = _equalCreateConversionStmt(a, b);
break;
case T_CreateCastStmt:
retval = _equalCreateCastStmt(a, b);
break;
case T_DropCastStmt:
retval = _equalDropCastStmt(a, b);
break;
case T_A_Expr:
retval = _equalAExpr(a, b);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册