Skip to content

feat(update): apply QueryFields to RETURNING *#7740

Open
smf-h wants to merge 2 commits intogo-gorm:masterfrom
smf-h:feat/queryfields-update-returning
Open

feat(update): apply QueryFields to RETURNING *#7740
smf-h wants to merge 2 commits intogo-gorm:masterfrom
smf-h:feat/queryfields-update-returning

Conversation

@smf-h
Copy link
Copy Markdown
Contributor

@smf-h smf-h commented Mar 24, 2026

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Apply QueryFields to UPDATE ... RETURNING * by replacing the wildcard returning clause with explicit schema columns.

User Case Description

QueryFields already expands SELECT * into explicit columns in regular query paths.

However, UPDATE ... RETURNING * still uses a wildcard even when QueryFields is enabled.

This change makes update-returning queries consistent with the existing QueryFields behavior.

Fixes #7690

@propel-code-bot
Copy link
Copy Markdown
Contributor

propel-code-bot bot commented Mar 24, 2026

Apply QueryFields expansion to UPDATE ... RETURNING *

This PR updates update callbacks to replace RETURNING * with explicit schema columns when QueryFields is enabled, aligning update-returning behavior with existing select expansion. It adds helper logic to rewrite the RETURNING clause and introduces tests to validate that wildcard returning is eliminated across supported dialects, with qualified columns where applicable.

Key Changes

• Added applyQueryFieldsToReturningClause in callbacks/update.go to expand clause.Returning * into explicit schema columns when db.QueryFields is true
• Invoked applyQueryFieldsToReturningClause during update clause setup when RETURNING is supported
• Added tests in callbacks/update_test.go and tests/update_test.go to ensure RETURNING/OUTPUT uses explicit columns rather than *

Affected Areas

callbacks/update.go update callback flow
callbacks/update_test.go unit test coverage
tests/update_test.go integration-style update returning tests

This summary was automatically generated by @propel-code-bot

propel-code-bot[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found; changes appear correct and well-tested.

Status: No Issues Found | Risk: Low

Review Details

📁 3 files reviewed | 💬 0 comments

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

queryFields should also be applied to UPDATE .. RETURNING

1 participant