I already reported this at https://github.com/go-gorm/postgres/issues/159 a while ago, but it was ignored until now, probably because it's an issue in gorm itself. Since it's turning more and more into an issue for me, I decided to report it here as well:

go (simplified):

type ArgumentList []interface{}   // custom slice-type

// Never called, if `a` is nil (since v1.24.4):
func (a ArgumentList) Value() (driver.Value, error) {
    js, _ := a.MarshalJSON() // Returns a json-array. Nil-slices return "[]".
    return datatypes.JSON(js).Value()
}

func (a *ArgumentList) Scan(value interface{}) error {
    var js datatypes.JSON
    js.Scan(value)
    return json.Unmarshal(js, a)
}

Before 1.4.6, my serializers converted nil-slices to empty json-arrays ([] string). Now, they are ignored, nil gets converted into a PostgreSQL null, and my not-null-constraints are triggered. This prevents me from updating the gorm-dependency.

Comment From: maja42

The "workaround" for this (to support go get -u ./... in go modules) gets longer with each new gorm version:

in go.mod:

exclude gorm.io/gorm v1.24.4
exclude gorm.io/gorm v1.24.5
exclude gorm.io/gorm v1.24.6
exclude gorm.io/gorm v1.24.7
exclude gorm.io/gorm v1.25.0
exclude gorm.io/gorm v1.25.1

exclude gorm.io/driver/postgres v1.4.6
exclude gorm.io/driver/postgres v1.4.7
exclude gorm.io/driver/postgres v1.4.8
exclude gorm.io/driver/postgres v1.5.0

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: black-06

This is related to the postgres-driver, see https://github.com/jackc/pgx/issues/1566 for more infomation.

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days