@@ -3057,11 +3057,29 @@ pltcl_build_tuple_result(Tcl_Interp *interp, Tcl_Obj **kvObjv, int kvObjc,
30573057char * fieldName = utf_e2u (Tcl_GetString (kvObjv [i ]));
30583058int attn = SPI_fnumber (call_state -> ret_tupdesc ,fieldName );
30593059
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 ;
30613068ereport (ERROR ,
30623069(errcode (ERRCODE_UNDEFINED_COLUMN ),
30633070errmsg ("column name/value list contains nonexistent column name \"%s\"" ,
30643071fieldName )));
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 ;
30653083
30663084values [attn - 1 ]= utf_e2u (Tcl_GetString (kvObjv [i + 1 ]));
30673085}