diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-31 22:10:48 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-31 22:10:48 +0000 |
commit | 845a6c3acccea0ec34e70808787aa7d431b0d96d (patch) | |
tree | c6e162146378dc6cdb62793d3b30674b6d64d465 /src/backend/nodes/copyfuncs.c | |
parent | 1440acd703e04f39340f7fb3a432b028a791e038 (diff) | |
download | postgresql-845a6c3acccea0ec34e70808787aa7d431b0d96d.tar.gz postgresql-845a6c3acccea0ec34e70808787aa7d431b0d96d.zip |
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.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 5b35eea170a..1938e7f4738 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -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; |