Open turip opened 8 months ago
The example creates a database then a table with two columns: ID and Value.
I add rows, ID is sequential, value is either ID or NULL:
Then I use gorm's scanrows to scan the data into the same struct, I would expect that for odd rows value will be 0, for even rows value will match ID.
Starting from v1.25.1 this is not the case, and Null columns are just ignored.
Just execute test.sh to run it against different versions of gorm.
test.sh
See testlog for run results.
Testing with gorm v1.23.9 gorm-v1.23.9:PASS Testing with gorm v1.24.6 gorm-v1.24.6:PASS Testing with gorm v1.25.0 gorm-v1.25.0:PASS Testing with gorm v1.25.1 gorm-v1.25.1:MISSMATCH: id=3 value=2 expected_value=0 gorm-v1.25.1:MISSMATCH: id=5 value=4 expected_value=0 ....
Due to the depency changes, I haven't created a test, but based on the code it should be pretty straightforward.
The example creates a database then a table with two columns: ID and Value.
I add rows, ID is sequential, value is either ID or NULL:
Then I use gorm's scanrows to scan the data into the same struct, I would expect that for odd rows value will be 0, for even rows value will match ID.
Starting from v1.25.1 this is not the case, and Null columns are just ignored.
Usage
Just execute
test.sh
to run it against different versions of gorm.See testlog for run results.
Run results