Skip to content

Conversation

aviyam181199
Copy link
Contributor

@aviyam181199 aviyam181199 commented Jan 7, 2025

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

What does this pull request do?

This pull request fixes the merging behavior of two clause.Returning clauses. Specifically, it ensures that if a clause.Returning contains expressions without Columns, it won't be overridden by specific columns during the merge. This addresses an issue caused by the implicit behavior of empty clause.Returning clauses.

Use Case Description

I work with queries involving multiple embedded models, where each model requires different columns to be returned. Some operations need all columns to be returned, while others need a subset.

Currently, the merging strategy overrides an implicit empty clause.Returning clause with specific columns, making it impossible to implement this mechanism. This fix resolves that limitation, enabling better control over the returned columns in complex query scenarios.

@jinzhu jinzhu merged commit 8503287 into go-gorm:master Jan 12, 2025
35 checks passed
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.

3 participants