*** ../pgsql_head/src/backend/rewrite/rewriteHandler.c 2005-05-27 02:38:08.000000000 -0500 --- src/backend/rewrite/rewriteHandler.c 2005-05-27 14:36:58.000000000 -0500 *************** *** 376,381 **** --- 376,389 ---- new_expr = build_column_default(target_relation, attrno); /* + * I will do this only in case of relkind == RELKIND_VIEW. + * This is the last attempt to get a value for new_expr before we + * consider that new_expr must be NULL. + */ + if (!new_expr && target_relation->rd_rel->relkind == RELKIND_VIEW) + new_expr = (Expr *) makeNode(SetToDefault); + + /* * If there is no default (ie, default is effectively NULL), * we can omit the tlist entry in the INSERT case, since the * planner can insert a NULL for itself, and there's no point