Skip to content

Apply QueryFields to RETURNING clauses #7804

Description

@haru0017

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions