mirror of
https://github.com/postgres/postgres.git
synced 2026-04-23 23:28:01 -04: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:
parent
e82858f013
commit
2aee785469
1 changed files with 9 additions and 2 deletions
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.89 2004/12/31 22:00:46 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.89.4.1 2006/01/06 20:11:24 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
#include "optimizer/clauses.h"
|
||||
#include "optimizer/tlist.h"
|
||||
#include "parser/parsetree.h"
|
||||
#include "parser/parse_coerce.h"
|
||||
#include "parser/parse_relation.h"
|
||||
#include "rewrite/rewriteManip.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
|
@ -897,7 +898,13 @@ resolve_one_var(Var *var, 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,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue