Describe the feature
When QueryFields is enabled, clause.Returning{} with empty Columns should generate an explicit column list from the model schema (e.g. RETURNING "id", "name", "created_at") instead of RETURNING *.
This would be consistent with how QueryFields already handles SELECT.
Motivation
QueryFields avoids SELECT * by expanding to explicit column lists. RETURNING * has the same issue but is not currently covered by QueryFields. For example, during rolling deployments, a migration may add a column before all application instances are updated, causing a column count mismatch between the table and the Go model.
Related Issues
#7690 requests the same for UPDATE ... RETURNING. RETURNING is used in Create, Update, and Delete callbacks, so ideally all three should be covered.
Describe the feature
When
QueryFieldsis enabled,clause.Returning{}with emptyColumnsshould generate an explicit column list from the model schema (e.g.RETURNING "id", "name", "created_at") instead ofRETURNING *.This would be consistent with how
QueryFieldsalready handlesSELECT.Motivation
QueryFieldsavoidsSELECT *by expanding to explicit column lists.RETURNING *has the same issue but is not currently covered byQueryFields. For example, during rolling deployments, a migration may add a column before all application instances are updated, causing a column count mismatch between the table and the Go model.Related Issues
#7690 requests the same for
UPDATE ... RETURNING.RETURNINGis used in Create, Update, and Delete callbacks, so ideally all three should be covered.