|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.114 2008/10/04 21:56:54 tgl Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.115 2008/10/06 17:39:26 tgl Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -1057,25 +1057,28 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
|
1057 | 1057 | {
|
1058 | 1058 | /* Must expand whole-tuple reference into RowExpr */
|
1059 | 1059 | RowExpr*rowexpr;
|
| 1060 | +List*colnames; |
1060 | 1061 | List*fields;
|
1061 | 1062 |
|
1062 | 1063 | /*
|
1063 | 1064 | * If generating an expansion for a var of a named rowtype
|
1064 | 1065 | * (ie, this is a plain relation RTE), then we must include
|
1065 | 1066 | * dummy items for dropped columns. If the var is RECORD (ie,
|
1066 |
| - * this is a JOIN), then omit dropped columns. |
| 1067 | + * this is a JOIN), then omit dropped columns. Either way, |
| 1068 | + * attach column names to the RowExpr for use of ruleutils.c. |
1067 | 1069 | */
|
1068 | 1070 | expandRTE(context->target_rte,
|
1069 | 1071 | this_varno,this_varlevelsup,var->location,
|
1070 | 1072 | (var->vartype!=RECORDOID),
|
1071 |
| -NULL,&fields); |
| 1073 | +&colnames,&fields); |
1072 | 1074 | /* Adjust the generated per-field Vars... */
|
1073 | 1075 | fields= (List*)ResolveNew_mutator((Node*)fields,
|
1074 | 1076 | context);
|
1075 | 1077 | rowexpr=makeNode(RowExpr);
|
1076 | 1078 | rowexpr->args=fields;
|
1077 | 1079 | rowexpr->row_typeid=var->vartype;
|
1078 | 1080 | rowexpr->row_format=COERCE_IMPLICIT_CAST;
|
| 1081 | +rowexpr->colnames=colnames; |
1079 | 1082 | rowexpr->location=-1;
|
1080 | 1083 |
|
1081 | 1084 | return (Node*)rowexpr;
|
|