Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When column is NULL it takes the value from previous record #5468

Closed
khanakia opened this issue Jun 28, 2022 · 4 comments
Closed

When column is NULL it takes the value from previous record #5468

khanakia opened this issue Jun 28, 2022 · 4 comments
Assignees
Labels

Comments

@khanakia
Copy link

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"
  }
]
@github-actions github-actions bot added the type:missing reproduction steps missing reproduction steps label Jun 28, 2022
@github-actions
Copy link

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.ioSearch Before Asking

@khanakia
Copy link
Author

@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

@github-actions
Copy link

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.ioSearch Before Asking

@a631807682
Copy link
Member

duplicated of #5415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants