mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Code review for domain-constraints patch. Use a new ConstraintTest node
type for runtime constraint checks, instead of misusing the parse-time Constraint node for the purpose. Fix some damage introduced into type coercion logic; in particular ensure that a coerced expression tree will read out the correct result type when inspected (patch had broken some RelabelType cases). Enforce domain NOT NULL constraints against columns that are omitted from an INSERT.
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.208 2002/08/30 19:23:19 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.209 2002/08/31 22:10:43 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -973,10 +973,6 @@ _copyJoinExpr(JoinExpr *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyCaseExpr
|
||||
* ----------------
|
||||
*/
|
||||
static CaseExpr *
|
||||
_copyCaseExpr(CaseExpr *from)
|
||||
{
|
||||
@ -994,10 +990,6 @@ _copyCaseExpr(CaseExpr *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyCaseWhen
|
||||
* ----------------
|
||||
*/
|
||||
static CaseWhen *
|
||||
_copyCaseWhen(CaseWhen *from)
|
||||
{
|
||||
@ -1012,10 +1004,6 @@ _copyCaseWhen(CaseWhen *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyNullTest
|
||||
* ----------------
|
||||
*/
|
||||
static NullTest *
|
||||
_copyNullTest(NullTest *from)
|
||||
{
|
||||
@ -1030,10 +1018,6 @@ _copyNullTest(NullTest *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyBooleanTest
|
||||
* ----------------
|
||||
*/
|
||||
static BooleanTest *
|
||||
_copyBooleanTest(BooleanTest *from)
|
||||
{
|
||||
@ -1048,6 +1032,23 @@ _copyBooleanTest(BooleanTest *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static ConstraintTest *
|
||||
_copyConstraintTest(ConstraintTest *from)
|
||||
{
|
||||
ConstraintTest *newnode = makeNode(ConstraintTest);
|
||||
|
||||
/*
|
||||
* copy remainder of node
|
||||
*/
|
||||
Node_Copy(from, newnode, arg);
|
||||
newnode->testtype = from->testtype;
|
||||
if (from->name)
|
||||
newnode->name = pstrdup(from->name);
|
||||
Node_Copy(from, newnode, check_expr);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static ArrayRef *
|
||||
_copyArrayRef(ArrayRef *from)
|
||||
{
|
||||
@ -3206,6 +3207,9 @@ copyObject(void *from)
|
||||
case T_BooleanTest:
|
||||
retval = _copyBooleanTest(from);
|
||||
break;
|
||||
case T_ConstraintTest:
|
||||
retval = _copyConstraintTest(from);
|
||||
break;
|
||||
case T_FkConstraint:
|
||||
retval = _copyFkConstraint(from);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user