@@ -3057,11 +3057,29 @@ pltcl_build_tuple_result(Tcl_Interp *interp, Tcl_Obj **kvObjv, int kvObjc,
3057
3057
char * fieldName = utf_e2u (Tcl_GetString (kvObjv [i ]));
3058
3058
int attn = SPI_fnumber (call_state -> ret_tupdesc ,fieldName );
3059
3059
3060
- if (attn <=0 || call_state -> ret_tupdesc -> attrs [attn - 1 ]-> attisdropped )
3060
+ /*
3061
+ * As in pltcl_trigger_handler, silently ignore ".tupno" if it's in
3062
+ * the list but doesn't match any column name.
3063
+ */
3064
+ if (attn == SPI_ERROR_NOATTRIBUTE )
3065
+ {
3066
+ if (strcmp (fieldName ,".tupno" )== 0 )
3067
+ continue ;
3061
3068
ereport (ERROR ,
3062
3069
(errcode (ERRCODE_UNDEFINED_COLUMN ),
3063
3070
errmsg ("column name/value list contains nonexistent column name \"%s\"" ,
3064
3071
fieldName )));
3072
+ }
3073
+
3074
+ if (attn <=0 )
3075
+ ereport (ERROR ,
3076
+ (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
3077
+ errmsg ("cannot set system attribute \"%s\"" ,
3078
+ fieldName )));
3079
+
3080
+ /* Ignore dropped attributes */
3081
+ if (call_state -> ret_tupdesc -> attrs [attn - 1 ]-> attisdropped )
3082
+ continue ;
3065
3083
3066
3084
values [attn - 1 ]= utf_e2u (Tcl_GetString (kvObjv [i + 1 ]));
3067
3085
}