diff options
author | Vadim B. Mikheev <vadim4o@yahoo.com> | 1997-08-19 04:46:15 +0000 |
---|---|---|
committer | Vadim B. Mikheev <vadim4o@yahoo.com> | 1997-08-19 04:46:15 +0000 |
commit | b992e200b8872ecb6652ec85111995f8d4c5aee0 (patch) | |
tree | 52ce3eed9d36e779fe3fa729c12757b13a521b56 /src/backend/executor/execMain.c | |
parent | b99c63cfc029cc0552e98f652d1734aec1124a5b (diff) | |
download | postgresql-b992e200b8872ecb6652ec85111995f8d4c5aee0.tar.gz postgresql-b992e200b8872ecb6652ec85111995f8d4c5aee0.zip |
NOT NULL implementation (submitted by Robson Paniago de Miranda).
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index b79be5d746f..b839ececc09 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -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. * ---------------- */ @@ -911,6 +912,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 * ---------------- */ @@ -1031,6 +1047,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 * * Don't want to continue if our heap_replace didn't actually |