diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-19 23:55:03 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-01-19 23:55:03 +0000 |
commit | 6d1efd76fb9852b8bc242dcaf35916090d7c5899 (patch) | |
tree | f827384a43f7dc18532337d555038e02498368b0 /src/backend/executor/execMain.c | |
parent | 08fb7375e35863e0ba2b8bb6a6c75802ca13fe85 (diff) |
Fix handling of NULL constraint conditions: per SQL92 spec, a NULL result
from a constraint condition does not violate the constraint (cf. discussion
on pghackers 12/9/99). Implemented by adding a parameter to ExecQual,
specifying whether to return TRUE or FALSE when the qual result is
really NULL in three-valued boolean logic. Currently, ExecRelCheck is
the only caller that asks for TRUE, but if we find any other places that
have the wrong response to NULL, it'll be easy to fix them.
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index fa98950ac1f..863c13b64ec 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.105 2000/01/17 23:57:45 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.106 2000/01/19 23:54:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1487,7 +1487,6 @@ ExecRelCheck(Relation rel, HeapTuple tuple, EState *estate) RangeTblEntry *rte = makeNode(RangeTblEntry); List *rtlist; List *qual; - bool res; int i; slot->val = tuple; @@ -1526,9 +1525,12 @@ ExecRelCheck(Relation rel, HeapTuple tuple, EState *estate) { qual = estate->es_result_relation_constraints[i]; - res = ExecQual(qual, econtext); - - if (!res) + /* + * NOTE: SQL92 specifies that a NULL result from a constraint + * expression is not to be treated as a failure. Therefore, + * tell ExecQual to return TRUE for NULL. + */ + if (! ExecQual(qual, econtext, true)) return check[i].ccname; } |