@@ -275,7 +275,7 @@ func (p *planner) Update(
275
275
// If rowsNeeded is set, we have requested from the source above
276
276
// all the columns from the descriptor. However, to ensure that
277
277
// modified rows include all columns, the construction of the
278
- // source has used publicAndNonVivible columns so the source may
278
+ // source has used publicAndNonPublicColumns so the source may
279
279
// contain additional columns for every newly added column not yet
280
280
// visible.
281
281
// We do not want these to be available for RETURNING below.
@@ -675,7 +675,15 @@ func (u *updateNode) processSourceRow(params runParams, sourceVals tree.Datums)
675
675
676
676
// If result rows need to be accumulated, do it.
677
677
if u .run .rows != nil {
678
- if _ , err := u .run .rows .AddRow (params .ctx , newValues ); err != nil {
678
+ // The new values can include all columns, the construction of the
679
+ // values has used publicAndNonPublicColumns so the values may
680
+ // contain additional columns for every newly added column not yet
681
+ // visible. We do not want them to be available for RETURNING.
682
+ //
683
+ // MakeUpdater guarantees that the first columns of the new values
684
+ // are those specified u.columns.
685
+ resultValues := newValues [:len (u .columns )]
686
+ if _ , err := u .run .rows .AddRow (params .ctx , resultValues ); err != nil {
679
687
return err
680
688
}
681
689
}
0 commit comments