@@ -188,8 +188,9 @@ check_attributes(Variable *variable, TupleDesc tupdesc)
188
188
if (record->tupdesc->natts != tupdesc->natts)
189
189
ereport(ERROR,
190
190
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
191
- errmsg("new record structure differs from variable \"%s\" "
192
- "structure", GetName(variable))));
191
+ errmsg("new record structure have %d attributes, but variable "
192
+ "\"%s\" structure have %d.",
193
+ tupdesc->natts, GetName(variable), record->tupdesc->natts)));
193
194
194
195
/* Second, check columns type. */
195
196
for (i = 0; i < tupdesc->natts; i++)
@@ -202,8 +203,10 @@ check_attributes(Variable *variable, TupleDesc tupdesc)
202
203
|| (attr1->atttypmod != attr2->atttypmod))
203
204
ereport(ERROR,
204
205
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
205
- errmsg("new record structure differs from variable \"%s\" "
206
- "structure", GetName(variable))));
206
+ errmsg("new record attribute type for attribute number %d "
207
+ "differs from variable \"%s\" structure. You may "
208
+ "need explicit type casts.",
209
+ i + 1, GetName(variable))));
207
210
}
208
211
}
209
212
0 commit comments