Open ldjebran opened 7 months ago
Panic Occurs when Mixing Joins and Preload with the same field eg query like
DB.Joins("Update.Repo").Joins("Update").Preload("Update.DispatchRecords").Find(&deviceUpdates)
will panic with
panic: reflect: call of reflect.Value.Field on slice Value [recovered] panic: reflect: call of reflect.Value.Field on slice Value goroutine 15 [running]: testing.tRunner.func1.2({0xc50dc0, 0xc000013e78}) /home/djlezzou/bin/go/src/testing/testing.go:1526 +0x24e testing.tRunner.func1() /home/djlezzou/bin/go/src/testing/testing.go:1529 +0x39f panic({0xc50dc0, 0xc000013e78}) /home/djlezzou/bin/go/src/runtime/panic.go:884 +0x213 reflect.Value.Field({0xc1db00?, 0xc000012798?, 0xc0004e81a8?}, 0xc00001f970?) /home/djlezzou/bin/go/src/reflect/value.go:1268 +0xe5 gorm.io/gorm/schema.(*Field).setupValuerAndSetter.func4({0xd3e90f?, 0x6?}, {0xc1db00?, 0xc000012798?, 0x10?}) /home/djlezzou/projects/gorm/playground/gorm/schema/field.go:503 +0x65 gorm.io/gorm/callbacks.preloadEntryPoint(0xc0001845d0, {0xc00001f970, 0x1, 0x1}, 0xc0004b7748, 0xc000012798?, {0x0, 0x0, 0x0}) /home/djlezzou/projects/gorm/playground/gorm/callbacks/preload.go:124 +0x429 gorm.io/gorm/callbacks.Preload(0xc000023b90) /home/djlezzou/projects/gorm/playground/gorm/callbacks/query.go:283 +0x2e5 gorm.io/gorm.(*processor).Execute(0xc0002508c0, 0xc00025c360?) /home/djlezzou/projects/gorm/playground/gorm/callbacks.go:130 +0x3ce gorm.io/gorm.(*DB).Find(0x1221520?, {0xc04c60?, 0xc000012798}, {0x0, 0x0, 0x0}) /home/djlezzou/projects/gorm/playground/gorm/finisher_api.go:170 +0x137 gorm.io/playground.TestGORM1(0x0?) /home/djlezzou/projects/gorm/playground/main_test.go:72 +0x4ad testing.tRunner(0xc000583380, 0xd97258) /home/djlezzou/bin/go/src/testing/testing.go:1576 +0x10b created by testing.(*T).Run /home/djlezzou/bin/go/src/testing/testing.go:1629 +0x3ea
Explain your user case and expected results
Panic Occurs when Mixing Joins and Preload with the same field eg query like
will panic with