mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
NOT NULL implementation (submitted by Robson Paniago de Miranda).
This commit is contained in:
@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.15 1997/08/18 20:52:25 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.16 1997/08/19 04:43:45 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -401,6 +401,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
if (resultRelation != 0 && operation != CMD_SELECT) {
|
||||
/* ----------------
|
||||
* if we have a result relation, open it and
|
||||
|
||||
* initialize the result relation info stuff.
|
||||
* ----------------
|
||||
*/
|
||||
@ -910,6 +911,21 @@ ExecAppend(TupleTableSlot *slot,
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* ----------------
|
||||
* Check the constraints of a tuple
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
if (resultRelationDesc->rd_att->constr && resultRelationDesc->rd_att->constr->has_not_null)
|
||||
{
|
||||
int attrChk;
|
||||
for (attrChk = 1; attrChk <= resultRelationDesc->rd_att->natts; attrChk++) {
|
||||
if (resultRelationDesc->rd_att->attrs[attrChk-1]->attnotnull && heap_attisnull(tuple,attrChk))
|
||||
elog(WARN,"ExecAppend: Fail to add null value in not null attribute %s",
|
||||
resultRelationDesc->rd_att->attrs[attrChk-1]->attname.data);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* insert the tuple
|
||||
* ----------------
|
||||
@ -1030,6 +1046,21 @@ ExecReplace(TupleTableSlot *slot,
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* ----------------
|
||||
* Check the constraints of a tuple
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
if (resultRelationDesc->rd_att->constr && resultRelationDesc->rd_att->constr->has_not_null)
|
||||
{
|
||||
int attrChk;
|
||||
for (attrChk = 1; attrChk <= resultRelationDesc->rd_att->natts; attrChk++) {
|
||||
if (resultRelationDesc->rd_att->attrs[attrChk-1]->attnotnull && heap_attisnull(tuple,attrChk))
|
||||
elog(WARN,"ExecReplace: Fail to update null value in not null attribute %s",
|
||||
resultRelationDesc->rd_att->attrs[attrChk-1]->attname.data);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* replace the heap tuple
|
||||
*
|
||||
|
Reference in New Issue
Block a user