mirror of
https://github.com/postgres/postgres.git
synced 2025-08-25 20:23:07 +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:
@@ -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,11 +1483,25 @@ _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;
|
||||
|
Reference in New Issue
Block a user