1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +03:00

Fix failure to apply domain constraints to a NULL constant that's added to

an INSERT target list during rule rewriting.  Per report from John Supplee.
This commit is contained in:
Tom Lane
2006-01-06 20:11:31 +00:00
parent e9b0c2d4bd
commit 2942023a2a

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.80 2003/10/20 20:01:59 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.80.2.1 2006/01/06 20:11:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,6 +18,7 @@
#include "optimizer/tlist.h"
#include "parser/parsetree.h"
#include "parser/parse_clause.h"
#include "parser/parse_coerce.h"
#include "rewrite/rewriteManip.h"
#include "utils/lsyscache.h"
@@ -904,7 +905,11 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
else
{
/* Otherwise replace unmatched var with a null */
return (Node *) makeNullConst(var->vartype);
/* need coerce_to_domain in case of NOT NULL domain constraint */
return coerce_to_domain((Node *) makeNullConst(var->vartype),
InvalidOid,
var->vartype,
COERCE_IMPLICIT_CAST);
}
}
else