go-pg / pg

Golang ORM with focus on PostgreSQL features and performance
https://pg.uptrace.dev/
BSD 2-Clause "Simplified" License
5.65k stars 401 forks source link

new instance of the struct type for scanjsonvalue #1979 #1984

Open Slitherings opened 1 year ago

Slitherings commented 1 year ago

First pull request, wasn't able to test or make sure but this code looks like a fix towards the Scan JSON value get panic #1979 issue (not sure about the "return nil" code on 269) but aside from that hopefully this can be a step towards fixing this issue, but I saw this as a good time to push a potential fix since pg is in the process of migrating to Bun.

elliotcourant commented 1 year ago

I kind of dropped the ball on that issue and never looped back to it sorry. I can take a closer look at this code locally soon and see if I can come up with a test or point you in a direction for a test.

Slitherings commented 11 months ago

I kind of dropped the ball on that issue and never looped back to it sorry. I can take a closer look at this code locally soon and see if I can come up with a test or point you in a direction for a test.

All good, keep me posted just trying to help!

elliotcourant commented 11 months ago

@Slitherings is there a unit test to support this change?

elliotcourant commented 11 months ago

Sorry pushing all the wrong buttons, I need to figure out how to get this tested. Ideally we should have a unit test that would have failed before this patch but passes with it.