GORM Playground Link

https://github.com/khanakia/gorm_playground_scan_null

Description

Run code: GORM_DIALECT=postgres go test Postgres copying the previous value into the null column

Screenshot 2022-06-28 at 4 47 28 PM

Expected Result

[
  {
    "id": "b",
    "name": "test"
  },
  {
    "id": "a",
    "name": ""
  }
]

Returned

[
  {
    "id": "b",
    "name": "test"
  },
  {
    "id": "a",
    "name": "test"
  }
]

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: khanakia

@jinzhu Issue exists with gorm.io/gorm v1.23.6

When I comment out this line replace gorm.io/gorm => ./gorm in go.mod then it gives the above NULL column error

go.mod (When enabled 1.23.6 issue occurs)

module gorm.io/playground

go 1.16

require (
    github.com/denisenkom/go-mssqldb v0.12.2 // indirect
    github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
    github.com/jackc/pgx/v4 v4.16.1 // indirect
    github.com/mattn/go-sqlite3 v1.14.13 // indirect
    golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
    gorm.io/driver/mysql v1.3.4
    gorm.io/driver/postgres v1.3.7
    gorm.io/driver/sqlite v1.3.4
    gorm.io/driver/sqlserver v1.3.2
    gorm.io/gorm v1.23.6
)

// replace gorm.io/gorm => ./gorm

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: a631807682

duplicated of #5415