|
7 | 7 | * |
8 | 8 | * |
9 | 9 | * IDENTIFICATION |
10 | | - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.94 2005/11/23 17:21:03 tgl Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.95 2006/01/06 20:11:12 tgl Exp $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
|
18 | 18 | #include"optimizer/clauses.h" |
19 | 19 | #include"optimizer/tlist.h" |
20 | 20 | #include"parser/parsetree.h" |
| 21 | +#include"parser/parse_coerce.h" |
21 | 22 | #include"parser/parse_relation.h" |
22 | 23 | #include"rewrite/rewriteManip.h" |
23 | 24 | #include"utils/lsyscache.h" |
@@ -838,7 +839,13 @@ resolve_one_var(Var *var, ResolveNew_context *context) |
838 | 839 | else |
839 | 840 | { |
840 | 841 | /* Otherwise replace unmatched var with a null */ |
841 | | -return (Node*)makeNullConst(var->vartype); |
| 842 | +/* need coerce_to_domain in case of NOT NULL domain constraint */ |
| 843 | +returncoerce_to_domain((Node*)makeNullConst(var->vartype), |
| 844 | +InvalidOid, |
| 845 | +var->vartype, |
| 846 | +COERCE_IMPLICIT_CAST, |
| 847 | +false, |
| 848 | +false); |
842 | 849 | } |
843 | 850 | } |
844 | 851 | else |
|