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:
parent
e9b0c2d4bd
commit
2942023a2a
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 "optimizer/tlist.h"
|
||||||
#include "parser/parsetree.h"
|
#include "parser/parsetree.h"
|
||||||
#include "parser/parse_clause.h"
|
#include "parser/parse_clause.h"
|
||||||
|
#include "parser/parse_coerce.h"
|
||||||
#include "rewrite/rewriteManip.h"
|
#include "rewrite/rewriteManip.h"
|
||||||
#include "utils/lsyscache.h"
|
#include "utils/lsyscache.h"
|
||||||
|
|
||||||
@ -904,7 +905,11 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Otherwise replace unmatched var with a null */
|
/* 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
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user