Skip to content

Custom preloading sql cannot be used properly. #7482

@sejeongdev

Description

@sejeongdev

Hello.

I was using the preload function using the subquery through custom preloading sql in gorm, but the recent update made it impossible to use the subquery in the preload.

go-gorm/playground#807
I've written a detailed case in the pull request above.

Preload("Pets", func(db *gorm.DB) *gorm.DB { subscope := db.Select("MAX(id) as id").Model(&Pet{}).Group("name") return db.Where("id in (?)", subscope)

I'd appreciate it if you could check it out.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions