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/outfuncs.c | |
parent | 1440acd703e04f39340f7fb3a432b028a791e038 (diff) |
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/outfuncs.c')
-rw-r--r-- | src/backend/nodes/outfuncs.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index a92750caef1..8c255058068 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.171 2002/08/30 19:23:19 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.172 2002/08/31 22:10:43 tgl Exp $ * * NOTES * Every (plan) node in POSTGRES has an associated "out" routine which @@ -1471,7 +1471,6 @@ _outNullTest(StringInfo str, NullTest *node) { appendStringInfo(str, " NULLTEST :arg "); _outNode(str, node->arg); - appendStringInfo(str, " :nulltesttype %d ", (int) node->nulltesttype); } @@ -1484,12 +1483,26 @@ _outBooleanTest(StringInfo str, BooleanTest *node) { appendStringInfo(str, " BOOLEANTEST :arg "); _outNode(str, node->arg); - appendStringInfo(str, " :booltesttype %d ", (int) node->booltesttype); } /* + * ConstraintTest + */ +static void +_outConstraintTest(StringInfo str, ConstraintTest *node) +{ + appendStringInfo(str, " CONSTRAINTTEST :arg "); + _outNode(str, node->arg); + appendStringInfo(str, " :testtype %d :name ", + (int) node->testtype); + _outToken(str, node->name); + appendStringInfo(str, " :check_expr "); + _outNode(str, node->check_expr); +} + +/* * _outNode - * converts a Node into ascii string and append it to 'str' */ @@ -1750,6 +1763,9 @@ _outNode(StringInfo str, void *obj) case T_BooleanTest: _outBooleanTest(str, obj); break; + case T_ConstraintTest: + _outConstraintTest(str, obj); + break; case T_FuncCall: _outFuncCall(str, obj); break; |